Skip to content

Fix the broken Docker build and remove dead root config - #371

Merged
bardhh merged 1 commit into
mainfrom
fix/docker-build-and-root-config
Jul 28, 2026
Merged

Fix the broken Docker build and remove dead root config#371
bardhh merged 1 commit into
mainfrom
fix/docker-build-and-root-config

Conversation

@bardhh

@bardhh bardhh commented Jul 28, 2026

Copy link
Copy Markdown
Owner

The CPU container the README tells people to build does not build. Both Dockerfiles fail on their uv line, each in a different way:

.devcontainer/Dockerfile:43    uv pip install .
  -> error: No virtual environment found; run `uv venv` ... or pass `--system`

Dockerfile:48                  uv pip install --system --no-root .
  -> error: unexpected argument '--no-root' found

--no-root is a uv sync flag, not a uv pip install one, and uv refuses to install into the system interpreter unless you ask it to with --system. The two files started as copies of each other and drifted, so only one is referenced by docker-compose.yml and neither works.

What this does

Consolidates onto the root Dockerfile and fixes it. The install is now uv pip install --system ., and the source is copied before the install runs. That second part matters more than it looks: the version comes from src/cbfkit/VERSION through [tool.setuptools.dynamic], and setuptools treats a missing version file as a warning rather than an error, so installing from pyproject.toml alone quietly produced an empty cbfkit 0.0.0. docker-compose.yml now points at the surviving file, which also makes it symmetric with how gpu.Dockerfile was already referenced.

Bringing COPY . . back onto the live path makes the build context weight real, so .dockerignore got tighter: generated media, prose directories and local tool state are excluded, and the mypy_cache entry that never matched the actual .mypy_cache is fixed. That one directory was about 200 MB on its own. The context drops from 405 MB to 11 MB. README.md and LICENSE stay in, since setuptools reads both for wheel metadata.

Two files are deleted because they do nothing:

  • .gitattributes has been empty since 6e08796, two years ago. An empty one has no effect.
  • .devcontainer/devcontainer.json is superseded by .devcontainer/cbfkit-container/, which is what the README's dev-container instructions already name. The nested one also carries a debug config the top-level one lacks.

Finally, two descriptions that had drifted from their code. conftest.py's docstring claimed it configured mypy, ruff and bytecode caches plus XLA memory settings; it does none of those. .env.example advertised MYPY_CACHE_DIR, RUFF_CACHE_DIR and PYTHONPYCACHEPREFIX, none of which can work from a .env: the first two are separate processes that never load the file, and Python reads the third at interpreter startup, before conftest.py runs. JAX_ENABLE_X64 was the file's only uncommented line and is already set in src/cbfkit/__init__.py. The file now says plainly which variables work and which have to be exported in your shell.

Verification

pytest -m "not slow" tests gives 492 passed, 4 skipped. black and ruff are clean on conftest.py. docker-compose.yml parses and both services resolve. Nothing references the deleted paths. The files setuptools needs (pyproject.toml, uv.lock, README.md, LICENSE, VERSION, py.typed, and all seven codegen .j2 templates) survive the new .dockerignore.

The container build itself is not verified. I had no Docker daemon available, so the two uv fixes were checked by running the exact invocations against uv 0.9.12 rather than through a real build. One assumption is worth naming: --system requires the base image's Python not to be PEP 668 externally-managed. ros:humble-ros-base-jammy is Ubuntu 22.04, which predates that marker, so it should be fine. Worth confirming before merge:

docker compose -f .devcontainer/docker-compose.yml build cbfkit

Since this build appears to have been broken for some time, there may be a second failure sitting behind the first.

The CPU image the README documents has not been buildable. Both Dockerfiles
fail on their uv invocation, in different ways:

  .devcontainer/Dockerfile:43   uv pip install .
    -> error: No virtual environment found; ... pass `--system`

  Dockerfile:48                 uv pip install --system --no-root .
    -> error: unexpected argument '--no-root' found

`--no-root` belongs to `uv sync`, not `uv pip install`, and uv declines to
touch the system interpreter without `--system`. The two files were
near-duplicates that had drifted, so consolidate onto the root one and fix it:

- install with `uv pip install --system .`
- COPY the source before installing. The version is read from
  src/cbfkit/VERSION via [tool.setuptools.dynamic], and setuptools only warns
  when that file is missing, so installing from pyproject.toml alone quietly
  produced an empty cbfkit 0.0.0.
- point docker-compose at the surviving Dockerfile, matching how
  gpu.Dockerfile is already referenced

That puts `COPY . .` back on the live path, which makes context weight matter,
so tighten .dockerignore: drop generated media, prose directories and local
tool state, and fix the `mypy_cache` entry that never matched the real
`.mypy_cache` (~200 MB by itself). Context goes from 405 MB to 11 MB.
README.md and LICENSE stay, since setuptools reads both for wheel metadata.

Remove two files that do nothing:

- .gitattributes, empty since 6e08796 two years ago
- .devcontainer/devcontainer.json, superseded by cbfkit-container/, which is
  what the README's dev-container instructions already point at

Correct two stale descriptions. conftest.py's docstring claimed it configured
mypy, ruff and bytecode caches and XLA memory; it does none of that.
.env.example advertised MYPY_CACHE_DIR, RUFF_CACHE_DIR and PYTHONPYCACHEPREFIX,
none of which can work from a .env file: the first two are separate processes
that never load it, and Python reads the third at interpreter startup, before
conftest.py runs. JAX_ENABLE_X64 was the file's only uncommented line and is
already set in src/cbfkit/__init__.py.

Test suite unchanged: 492 passed, 4 skipped.
@bardhh
bardhh merged commit 0716739 into main Jul 28, 2026
4 checks passed
@bardhh
bardhh deleted the fix/docker-build-and-root-config branch July 28, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant