Docker Build Configuration¶
The docker/ folder at the repository root holds the Dockerfile and related configuration
for building container images.
Files¶
docker/Dockerfile— Multi-stage Docker build configurationdocker/Dockerfile.dockerignore— Build-context ignore rules scoped to that Dockerfile (see Notes)
The folder is not cosmetic: rhiza-task docker-build builds <docker_folder>/Dockerfile
with docker_folder defaulting to docker, and rhiza_docker.yml names the same path. Both
skip a Dockerfile they cannot find rather than failing, so a copy kept anywhere else is
linted, built and scanned by nothing — which is what #1641 was.
Python Version¶
The Python version is controlled by the .python-version file in the repository root (single source of truth).
Building with Make (Recommended)¶
The Makefile automatically reads .python-version and passes it to Docker:
Building Manually¶
If building manually, pass the version from .python-version:
docker buildx build \
--file docker/Dockerfile \
--build-arg PYTHON_VERSION=$(cat .python-version) \
--tag <image-name> \
--load \
.
Building the Image¶
Build from the repository root, using the root directory as the build context:
# Recommended: Use make target (reads .python-version automatically)
make docker-build
# Or manually with explicit version
docker buildx build \
--file docker/Dockerfile \
--build-arg PYTHON_VERSION=$(cat .python-version) \
--tag <image-name> \
--load \
.
This is the same approach used by the CI workflow (see .github/workflows/rhiza_docker.yml).
Notes on Dockerfile.dockerignore¶
- Docker/BuildKit supports a per-Dockerfile ignore file located next to the Dockerfile, named
Dockerfile.dockerignore. - This file applies only when building that specific Dockerfile and allows us to keep all Docker-related files together inside the
docker/folder. - No repository-root
.dockerignoreor symlink is required. - The ignore rules are evaluated relative to the build context (here: the repository root
.). Use paths accordingly. - You need BuildKit-enabled Docker (e.g.,
docker buildx, which is enabled by default in modern Docker versions).