Problem
I have two repositories A and B. I have a docker image registry, where I can push the docker images made of the repositories A and B.
I need only the binary of A's source code to be included in the docker image of B. So when running the docker image of B, the jar file of A is present and can be used. And in case of updates in repository A, the registry image is subsequently updated.
Question
I've searched now several threads and the docker documentation. Is there a recommended way to make this happen with docker respectivly dockerfile commands?
So far I tried the following and it worked, but it wasn't so intiutive. Is this the recommended way?
FROM myregistry/my-A-img AS A
FROM ubuntu-base-img
# Build commands for B ...
COPY build-B.jar /app
# Get the A image from the registry
COPY --from=A /path/to/build-A.jar /app/lib
# Run B binaries