Last active
December 30, 2023 18:51
-
-
Save rodion-arr/90c0c278316af1fde1b30a174f7eda5e to your computer and use it in GitHub Desktop.
NestJS Dockerfile example
This file contains hidden or 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
FROM node:20-alpine AS development | |
WORKDIR /usr/src/app | |
COPY ./package*.json ./ | |
RUN npm install | |
COPY ../.. . | |
RUN npm run build | |
FROM node:20-alpine as production | |
USER node | |
ARG NODE_ENV=production | |
ENV NODE_ENV=${NODE_ENV} | |
WORKDIR /usr/src/app | |
COPY --chown=node:node package*.json ./ | |
RUN npm install --omit=dev | |
COPY --from=development --chown=node:node /usr/src/app/dist ./dist | |
CMD ["node", "dist/index.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment