I have a Docker file which build a react application, and then runs an nginx server to serve the resulting webpack. I use a multi-stage build, something like:
# Dockerfile
# build application
FROM node:14-alpine AS builder
... project cofiguration
RUN npm run build
# copy to nginx
FROM nginx:stable-alpine
COPY --from=builder /app/build /usr/share/nginx/html
... more setup here
// docker-compose.yaml
version: '3'
services:
frontend-nginx:
build:
context: frontend
ports:
...
Now I need to add another web application, so I wish to split builder and nginx stages to separate Dockerfiles.
Is there a way to COPY --from
in docker-compose.yaml? Should I simply save the output of builder
to a shared volume, and access it at runtime from nginx?