From 726c9aaed5864ac2b7bb396477cb393c2c371c75 Mon Sep 17 00:00:00 2001 From: sprooty Date: Sat, 8 Aug 2026 05:32:30 +0000 Subject: [PATCH] Build the image from the whole tree, not a curated COPY list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first build of this image failed collecting `tests/test_deployment_docs.py`: the Dockerfile copied `src`, `tests` and `examples`, and the suite reads `docs/DEPLOYMENT.md`. Adding `docs` would have fixed that one test and left the trap. The `test` stage exists to run the repository's own gates in the image that gets deployed, and those gates read the repository — docs, `pyproject.toml` for the wheel build, `README.md`. Any curated list is a build failure waiting for the next test that reads a file nobody remembered. So the context is copied whole and `.dockerignore` names what must stay out: git history, the local virtualenv (wrong platform inside the image), and build caches. --- .dockerignore | 17 +++++++++++++++++ Dockerfile | 11 ++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..51dc879 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +# The build copies the whole tree so the gates run against the same files the +# repository gates do — see the Dockerfile. These are the ones that must not +# come with it: build caches, the local virtualenv (wrong platform inside the +# image), and git history the wheel build does not need. +.git +.github +.venv +dist +build +*.egg-info +__pycache__ +*.py[cod] +.pytest_cache +.mypy_cache +.ruff_cache +.coverage +htmlcov diff --git a/Dockerfile b/Dockerfile index c03b142..fbdd6b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,9 +63,14 @@ WORKDIR /app COPY pyproject.toml uv.lock README.md ./ RUN uv sync --frozen --no-install-project --all-extras -COPY src ./src -COPY tests ./tests -COPY examples ./examples +# The whole tree, not a hand-listed subset. The `test` stage below runs the +# repository's own gates, and those gates read the repository: the suite +# asserts against `docs/DEPLOYMENT.md`, builds a wheel from `pyproject.toml`, +# and reads `README.md`. A curated COPY list makes that a build failure every +# time a test starts reading a file nobody remembered to add — which is +# exactly how the first build of this image failed. `.dockerignore` names what +# must stay out. +COPY . . RUN uv sync --frozen --all-extras # ---------------------------------------------------------------- test