Created
February 14, 2020 12:00
-
-
Save julianwachholz/be5f24737ca270112d3dae9c966f7768 to your computer and use it in GitHub Desktop.
Dockerfile multi stage build for React single page apps
This file contains hidden or 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
version: "3.4" | |
services: | |
app: | |
build: | |
context: . | |
target: dev | |
ports: | |
- 3000:3000 |
This file contains hidden or 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
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