I have a microservices project with two containers. The basic file layout is like this:
.
├── backend
│ ├── .dockerignore
│ ├── Dockerfile
│ └── app.py
├── docker-compose.yml
└── frontend
├── App.js
└── Dockerfile
When I run balena push
it complains:
[Warn] The following .dockerignore file(s) will not be used:
[Warn] * /home/ubuntu/notification-server/backend/.dockerignore
[Warn] By default, only one .dockerignore file at the source folder (project
[Warn] root) is used. Microservices (multicontainer) fleets may use a separate
[Warn] .dockerignore file for each service with the --multi-dockerignore (-m)
[Warn] option. See "balena help push" for more details.
I don’t understand this. I thought that each service would be built independently, and thus each should be able to have its own .dockerignore
. Furthermore AFAIK the docker build process will actively refuse to consider anything outside of the root directory it’s building from - the so-called “context”. For security reasons, and layer caching reasons - it CAN NOT consider any files outside of the context.
So, why is the balena builder telling me to merge all the dockerignore
s from all my containers into one overarching one?