Skip to content

Instantly share code, notes, and snippets.

@julianwachholz
Created February 14, 2020 12:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianwachholz/be5f24737ca270112d3dae9c966f7768 to your computer and use it in GitHub Desktop.
Save julianwachholz/be5f24737ca270112d3dae9c966f7768 to your computer and use it in GitHub Desktop.
Dockerfile multi stage build for React single page apps
version: "3.4"
services:
app:
build:
context: .
target: dev
ports:
- 3000:3000
FROM node:13 AS build
WORKDIR /app
COPY package.json package-lock.json /app/
RUN npm install
FROM build as dev
COPY . /app
CMD BROWSER=none npm start
FROM build as prod
COPY . /app
RUN npm run build
FROM socialengine/nginx-spa:latest
COPY --from=prod /app/web/build /app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment