Skip to content

Instantly share code, notes, and snippets.

@MaximRouiller
Created February 21, 2019 19:04
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 MaximRouiller/cee13b5963919e9e308c812f085a75d9 to your computer and use it in GitHub Desktop.
Save MaximRouiller/cee13b5963919e9e308c812f085a75d9 to your computer and use it in GitHub Desktop.
NodeJS Multistage Dockerfile
#build stage for a Node.js application
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
#production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment