Search code examples
dockerdocker-composedockerfile

Docker single build artifact for multiple images


I have two .NET projects which depend on the same DLL. Currently, this DLL is building for each of the projects. Is there a way to build it once and share it among the Dockerfiles?


Solution

  • You should create the following docker image files:

    1. DLL dockerfile: it builds the DLL and stores the DLL.
    2. Project A fockerfile: it inherits from then "DLL dockerfile" and uses the DLL built from the base image.
    3. Project B dockerfile: same as for the "Project A".