Skip to content

Instantly share code, notes, and snippets.

@dhilipsiva
Created July 25, 2020 06:22
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 dhilipsiva/d996ea7c84f5823751ed09748cae718a to your computer and use it in GitHub Desktop.
Save dhilipsiva/d996ea7c84f5823751ed09748cae718a to your computer and use it in GitHub Desktop.
Multistage build dockerfile
# Stage 1: Build a React Docker Image
FROM node as build
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY . /app
RUN npm run build
# Stage 2, use the compiled app, ready for production with Nginx
FROM nginx
COPY --from=build /app/dist/out/ /usr/share/nginx/html
COPY /nginx-custom.conf /etc/nginx/conf.d/default.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment