Last active
October 11, 2021 11:10
-
-
Save ignavan39/6a935710e7f6ecf8a53520d33131f658 to your computer and use it in GitHub Desktop.
Dockerfile for NodeJs
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
/node_modules | |
/dist |
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:14.17-alpine as dev | |
WORKDIR /app/ | |
COPY ./yarn.lock ./package.json ./ | |
RUN yarn | |
COPY . . | |
FROM node:14.17-alpine as builder | |
WORKDIR /app/ | |
COPY --from=dev /app/ /app/ | |
RUN yarn build | |
FROM node:14.17-alpine | |
WORKDIR /app/ | |
COPY --from=builder /app/package.json ./ | |
COPY --from=builder /app/yarn.lock ./ | |
RUN NODE_ENV=production | |
RUN yarn | |
COPY --from=builder /app/dist ./dist | |
COPY --from=builder /app/.env .env | |
CMD ["yarn","start:prod"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment