I have a multicontainer project and run balena build
in CI. Rather than building the whole docker-compose, I have CI build each container individually, so that I can specify architecture. (this is a compromise for performance: some use amd64, some use emulated arm)
My preference would be to use a command analogous to docker-compose build foo
, which looks up foo
in the docker-compose.yml file and builds it.
I don’t see anything like this available from balena build
, so instead I reference the context directory and Dockerfile:
balena build -d amd64 -A amd64 --noparent-check --dockerfile Dockerfile.template project-directory
This works for services that have their own directories.
One of the services, though, lives at the root, sharing a directory with docker-compose.yml. This is necessary because the project needs the larger build context.
I try to build it individually like this:
balena build -d amd64 -A amd64 --noparent-check --dockerfile Dockerfile.foo.template .
But balena build
ignores my request and builds the whole project:
[Warn] Ignoring alternative dockerfile "Dockerfile.foo.template" because composition file "docker-compose.yml" exists
Is there a way to avoid this behavior?