Skip to content

Instantly share code, notes, and snippets.

@Asjas
Last active September 20, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Asjas/70f056278c91a7318ffc5b5e3e341a53 to your computer and use it in GitHub Desktop.
Save Asjas/70f056278c91a7318ffc5b5e3e341a53 to your computer and use it in GitHub Desktop.
Example Node.js Production Dockerfile
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