Created
May 2, 2020 08:11
-
-
Save farisshajahan/0e23004d13bf269429ddcd32d0ec93e6 to your computer and use it in GitHub Desktop.
Sample Multi-stage Dockerfile for Nest/Node projects
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
FROM node:12.14-alpine as development | |
RUN apk add python python3 make g++ | |
WORKDIR /usr/src/app | |
COPY . ./ | |
RUN npm install | |
RUN npm run build | |
RUN npm prune --production | |
FROM node:12.14-alpine as production | |
WORKDIR /usr/src/app | |
COPY . ./ | |
COPY --from=development /usr/src/app/dist ./dist | |
COPY --from=development /usr/src/app/node_modules ./node_modules | |
EXPOSE 4000 | |
CMD ["node", "dist/main"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment