Just thought you were saying I couldn’t use another file name. Probably misunderstood.
Your post did give me an idea on another way of doing it. I could just rename the docker ignore file before the build happens in the shell script like so:
#!/bin/bash
docker build -f apache.dockerfile --tag example/example-apache .
mv php.dockerfile.dockerignore .dockerignore
docker build -f php.dockerfile --tag example/example-php .
mv .dockerignore php.dockerfile.dockerignore
docker push example/example-apache
docker push example/example-php
docker rmi example/example-apache
docker rmi example/example-php
That just seems a little prettier than using rsync to copy files then delete them. It allows the build to go much faster as the total size with the static assets is 500MB vs 1MB of just php files.
Of course out of all of this, the cleanest way would for you to be able to specify a dockerignore file or one gets automatically selected like this post stated which didn’t work for me:
I am running docker version 19.03.1.