Skip to content

Instantly share code, notes, and snippets.

@YokiToki
Last active April 21, 2023 04:00
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 YokiToki/c50f07dcb19c5963aa96ec19646dce21 to your computer and use it in GitHub Desktop.
Save YokiToki/c50f07dcb19c5963aa96ec19646dce21 to your computer and use it in GitHub Desktop.
Multi-stage react build
FROM node:16-alpine AS builder
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
FROM nginx:1.23.4-alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/build .
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment