Skip to content

Instantly share code, notes, and snippets.

@greaveselliott
Created November 16, 2019 23:40
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 greaveselliott/7af9e6ba18806a52590be3a21dd1f623 to your computer and use it in GitHub Desktop.
Save greaveselliott/7af9e6ba18806a52590be3a21dd1f623 to your computer and use it in GitHub Desktop.
multi-stage builds
# Use the Node LTS image
# Step 1: Building our application
FROM node:lts-alpine AS builder
# Copying the project repo to the builder images default working directory /root
COPY . .
# Installing JS dependencies
RUN yarn
# Building the app
RUN yarn build
# Step 2: Serving our application with Nginx
FROM nginx
# Setting default working directory to public Nginx directory
WORKDIR /usr/share/nginx/html
# Copy files from `builder` /build directory
# to the nginx images root working directory
COPY --from=builder /build .
# Expose port 80 on the Nginx images
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment