Quantcast
Viewing all articles
Browse latest Browse all 45

copy --from in docker-compose multi-stage build

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 applicationFROM node:14-alpine AS builder... project cofigurationRUN npm run build# copy to nginxFROM nginx:stable-alpineCOPY --from=builder /app/build /usr/share/nginx/html... more setup here
// docker-compose.yamlversion: '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?


Viewing all articles
Browse latest Browse all 45

Trending Articles