I have multiple Dockerfiles in my project. One Dockerfiles builds the publishable image. The other builds an image based on that artifact with extra data for regression testing. The extra data is large, and slows down sending the context to the docker daemon for building the publishable image.
I am aware of .dockerfile
, but I only want to ignore the large directory with one Dockerfile. Is there a way to do something like
# Build publishable image
docker build --ignore-file .dockerignore-publish docker/Dockerfile-publish -t publish .
# Build regression image
docker build --ignore-file .dockerignore-regression docker/Dockerfile-regression -t regression .
where .dockerignore-regression
does not ignore the regression data directory, but .dockerignore-publish
does?
I suspect the standard answer is to only have one Dockerfile per project, or to change the root directory so only the regression build finds the regression data. Those could work, but are awkward in this case. A per-dockerfile solution would be the simplest option.