Reputation: 9169
My application is built using a multi-stage build in the following way.
Dockerfile 1
FROM debian:stretch as prebuilder
# Define the prebuilder
FROM prebuilder as build-stage
# Build app 1
FROM build-stage as run-stage
# Copy app 1 from build-stage and setup runtime environment
Dockerfile 2
FROM debian:stretch as prebuilder
# Define the prebuilder
FROM prebuilder as build-stage
# Build app 2
FROM build-stage as run-stage
# Copy app 2 from build-stage and setup runtime environment
The problem is that the prebuilder
and run-stage
are identical in app 1 and app 2 (except for the actual app files that are copied over from the build-stage
to the run-stage
. So I'm repeating myself unnecessarily in both Dockerfiles.
Are there any built-in constructs in Docker multi-stage builds to start a build stage using a build stage from another image (even though it's not the final stage)?
Thanks!
Upvotes: 0
Views: 329
Reputation: 1274
You can use the official Docker registry for local image registry platform.
This is how you can go about it:
Upvotes: 1