Last active
September 20, 2020 15:36
-
-
Save Asjas/70f056278c91a7318ffc5b5e3e341a53 to your computer and use it in GitHub Desktop.
Example Node.js Production Dockerfile
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:10.16.2-stretch | |
EXPOSE 3000 | |
ENV NODE_ENV production | |
# Create work environment and set up app | |
RUN mkdir /app && chown -R node:node /app | |
WORKDIR /app | |
USER node | |
COPY --chown=node:node package.json package-lock.json ./ | |
RUN npm install && npm cache clear --force | |
COPY --chown=node:node . . | |
RUN npm run build | |
CMD ["node", "dist/index.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment