I am building a php docker container that uses a Dockerfile.dockerignore file to only allow php files inside the container. The dockerignore file contains only two lines:
project/**/*
!*/**/*.php
Inside the Dockerfile itself, it installs some php extensions, and copies the php.ini as well as ./project to . . In the pipeline everything is built from the root directory, using docker build . -f "path/to/Dockerfile".
On the local machine, the image builds fine, and includes all expected files. But when build on the Bitbucket Pipeline, it only includes the php files in the root directory of the project.
On locally built:
$ docker run -it org/project bash
root@69afc4123684:/var/www/html# ls
PHPMailer cameraAssign cron favicon.php forgot home inc.php index.php login logout recover signup
In Bitbucket pipeline built:
$ docker run -it org/project bash
root@e1557e7def2b:/var/www/html# ls
favicon.php inc.php index.php
As you can see, the container built in the Bitbucket pipeline is missing all directories that should be in the base directory.
I have attempted different methods of running the docker build command, but have not found what could cause this discrepancy. Should I attempt to use docker buildx? Or is there some other way to get this to build correctly?