Created
July 14, 2023 22:06
-
-
Save Jarrodsz/13fd50d2eb93914fec560e4364fec650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Base node image. | |
FROM node:18-bullseye-slim as base | |
## --- START ENV | |
RUN apt-get update && apt-get install -y openssl curl | |
RUN pnpm install -g pnpm@latest | |
# Install all node_modules, including dev dependencies. | |
FROM base as deps | |
WORKDIR /app | |
ADD package.json pnpm-lock.yaml .npmrc ./ | |
RUN pnpm install | |
# Setup production node_modules. | |
FROM base as production-deps | |
WORKDIR /app | |
RUN rm -rf /app/node_modules /app/node_modules | |
COPY --from=deps /app/node_modules /app/node_modules | |
ADD package.json pnpm-lock.yaml .npmrc ./ | |
RUN pnpm prune --production | |
# Build the app | |
FROM base as build | |
WORKDIR /app | |
COPY --from=deps /app/node_modules /app/node_modules | |
# Run the typescript generators | |
ADD . ./ | |
RUN pnpm run build | |
WORKDIR /app | |
COPY --from=production-deps /app/node_modules /app/node_modules | |
COPY --from=build /app/build /app/build | |
COPY --from=build /app/public /app/public | |
COPY --from=build /app/dbschema/migrations /app/dbschema/migrations | |
COPY --from=build /app/start.sh /app/start.sh | |
ADD . ./ | |
CMD ["npm", "start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment