Skip to content

Instantly share code, notes, and snippets.

@yagoernandes
Created February 21, 2020 14:37
Show Gist options
  • Save yagoernandes/2c7b1103ebc84104d5133d55a5f782d8 to your computer and use it in GitHub Desktop.
Save yagoernandes/2c7b1103ebc84104d5133d55a5f782d8 to your computer and use it in GitHub Desktop.
Dockerfile for Node (Production)
FROM node:10.16
EXPOSE 8080
WORKDIR /app/
COPY . .
COPY package*.json ./
RUN npm install
RUN npm run build
RUN echo "finished building"
RUN ls -afl dist
FROM node:10.16-alpine
WORKDIR /app/
COPY --from=0 /app/dist ./dist
COPY package*.json ./
COPY --from=0 /app/node_modules ./node_modules
ENTRYPOINT NODE_ENV=production npm run start:prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment