The answer may be simple: just create 4 Dockerfileone depending on the other.
You can add a volume to share the assembly from part of the source. The question is whether you want the assets of the result to be included in the image or each time to create it from sources.
Create 4 folders to have Dockerfilein each.
Products
production/Dockefile:
FROM
COPY
Build
build/Dockerfile:
ADD
RUN
Debug
debug/Dockefile:
Test
test/Dockefile:
FROM
RUN
There are also several options. 1. Use a negative .gitignore (or ADD?)
*
!directory-i-want-to-add
!another-directory-i-want-to-add
Plus, use the docker command that defines the dockerfiles and context:
docker build -t my/debug-image -f docker-debug .
docker build -t my/serve-image -f docker-serve .
docker build -t my/build-image -f docker-build .
docker build -t my/test-image -f docker-test .
You can also use different gitignore files.
- Mount Volumes Skip the send context, just use the install volumes at runtime (using
-v host-dir:/docker-dir).
So you need to:
docker build -t my/build-image -f docker-build .
docker run -v output:/output my/build-image build-command
docker build -t my/serve-image -f docker-serve .
docker run my/serve-image
docker build -t my/serve-image -f docker-debug .
docker run my/serve-image