Skip to content

Instantly share code, notes, and snippets.

@theetrain
Created December 17, 2022 22:31
Show Gist options
  • Save theetrain/84adfd38daa4b03cfd600e129950e44d to your computer and use it in GitHub Desktop.
Save theetrain/84adfd38daa4b03cfd600e129950e44d to your computer and use it in GitHub Desktop.
Node Dockerfile
FROM node:18.12.1-alpine3.16 as nodebuilder
WORKDIR /app
COPY . .
RUN npm i
RUN npm run build
CMD npm i && npm start
# Run
# ====
FROM node:18.12.1-alpine3.16
WORKDIR /srv
COPY --from=nodebuilder /app/build /srv
COPY --from=nodebuilder /app/package*.json /srv/
RUN npm i --production
EXPOSE 3000
CMD node .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment