Created
November 16, 2019 23:40
-
-
Save greaveselliott/7af9e6ba18806a52590be3a21dd1f623 to your computer and use it in GitHub Desktop.
multi-stage builds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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