diff --git a/.gitea/workflows/image.yml b/.gitea/workflows/image.yml index dcd60d4..c8942bc 100644 --- a/.gitea/workflows/image.yml +++ b/.gitea/workflows/image.yml @@ -88,7 +88,7 @@ jobs: dockerfile: Dockerfile job_image: ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96 - name: ci - version: 0.2.26 + version: 0.2.27 subpath: "" dockerfile: images/ci/Dockerfile job_image: ubuntu:26.04@sha256:065aa8626841f16057b78b027b464cd59c4fac36c204c72dcbf48d66f5fa8a96 diff --git a/CLAUDE.md b/CLAUDE.md index c98a351..d7abffb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -118,7 +118,10 @@ Single-context: `GLOSSARY.md` and `docs/adr/` at the root, both created lazily. The docs sit outside the image directories on purpose: editing them is not an image input, so it needs no new version. Editing a label in a Dockerfile is an input and does. - Each pushed layer must stay below 100 MB: Cloudflare rejects larger request bodies with - HTTP 413. That is why the `ci` image deletes the Go toolchains from the hook cache. + HTTP 413. That is why the `ci` image deletes the Go toolchains from the hook cache and the unused + `libpython*.so` of its three baked interpreters (the `/opt/python` layer was 99 MB compressed with them, + ci 0.2.26 failed to push). The build prints the compressed size of each layer directory; the registry + stores about 9% more, so read that line before adding an interpreter or a hook environment. - `image.yml` is the only workflow that may reference the org Actions secrets (the registry push credential). Never print or use them anywhere else. ## Dependency automation (Renovate) diff --git a/images/ci/Dockerfile b/images/ci/Dockerfile index 968c51a..4b1d852 100644 --- a/images/ci/Dockerfile +++ b/images/ci/Dockerfile @@ -75,6 +75,21 @@ RUN python3 -m venv /opt/uv-venv \ && /opt/uv-venv/bin/pip install uv==0.13.8 \ && /opt/uv-venv/bin/uv python install 3.11 3.13 ${PYTHON_VERSION} +# python-build-standalone ships lib/libpython.so (about 33 MB, 10 MB compressed) next to a statically +# linked python binary; nothing in this image links it, and with it the /opt/python layer of three interpreters +# was 99.1 MB compressed, which Cloudflare refused with HTTP 413 (ci 0.2.26 failed to push). A copy is kept when +# the binary does link it, so a change of build flavour cannot break the interpreter. +RUN set -eu; \ + for v in $(printf '%s\n' 3.11 3.13 "${PYTHON_VERSION}" | sort -u); do \ + d="$(echo /opt/python/cpython-${v}.*/)"; \ + if ldd "${d}bin/python${v}" | grep -q libpython; then \ + echo "python${v} links libpython: keeping it"; \ + else \ + rm -f "${d}"lib/libpython*.so*; \ + fi; \ + done; \ + du -sh /opt/python + # The real path under /opt/python, which the final stage copies (/opt/python-bin does not exist there): # the venv's python is a symlink to the interpreter it was created from. RUN "$(echo /opt/python/cpython-${PYTHON_VERSION}.*/bin/python${PYTHON_VERSION})" -m venv /opt/venv \