Skip to content

Keep the site build's environment out of the website image in its COPY - #6468

Merged
max-sixty merged 1 commit into
mainfrom
tidy-root
Nov 19, 2026
Merged

max-sixty merged 1 commit into
mainfrom
tidy-root

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The website image copies .tmp/site-install, the prepared installation the site build ran its pages with, so that tree holds the build host's .venv and __pycache__. worker/Dockerfile.dockerignore kept them out only when Docker was given the Dockerfile's path. Wrangler passes the Dockerfile on stdin (-f -), so the dev image worker/deploy-dev.sh deploys copied both in, and leaf-dev site verify copied the ignore file to its context root to cover its own Wrangler build. COPY --exclude leaves them out however Docker gets the Dockerfile, so the ignore file and that copy step go.

Worth weighing: --exclude needs Dockerfile syntax 1.19 (1.18 refuses it), so the Dockerfile now starts with # syntax=docker/dockerfile:1, and each build fetches that frontend from Docker Hub rather than using the engine's built-in one.

Max asked for this as a follow-up to #6466. Checked: a stdin build with the same COPY line leaves out .venv and __pycache__ at the top of the tree and nested; docker build --check; pnpm run check:worker. This PR's test job builds the site and the image and serves it through wrangler dev.

This was written by Claude Code on behalf of max-sixty

The website image copies `.tmp/site-install`, the prepared installation the site
build ran its pages with, so that tree holds the build host's `.venv` and
`__pycache__`. `worker/Dockerfile.dockerignore` kept them out, but Docker reads
an ignore file beside the Dockerfile only when it is given the Dockerfile's path.
Wrangler passes the Dockerfile on stdin (`-f -`), so the dev image that
`worker/deploy-dev.sh` builds through Wrangler copied both in, and
`leaf-dev site verify` copied the ignore file to its context's root to cover the
same gap in its own Wrangler build.

`COPY --exclude` leaves them out however Docker receives the Dockerfile, so the
ignore file and the verifier's copy of it go. `--exclude` needs Dockerfile
syntax 1.19 (1.18 refuses the flag), so the Dockerfile names
`docker/dockerfile:1` rather than relying on the engine's built-in frontend.

Checked: a stdin build with the same `COPY` line leaves out `.venv` and
`__pycache__` both at the top of the tree and nested; `docker build --check`
parses the Dockerfile; `pnpm run check:worker`. The pull request's `test` job
builds the site and the image and serves it through `wrangler dev`.
@max-sixty
max-sixty merged commit f7a067e into main Nov 19, 2026
5 checks passed
@max-sixty
max-sixty deleted the tidy-root branch November 19, 2026 03:41
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.

2 participants