fix(image): drop the unused libpython shared libraries from the ci image #220

Merged
Defame1297 merged 1 commits from fix/ci-image-layer-size into main 2026-11-16 08:29:36 +00:00
Owner

What

images/ci/Dockerfile removes lib/libpython<MINOR>.so* from each baked python-build-standalone interpreter (3.11, 3.13 and the pinned PYTHON_VERSION), unless that interpreter's python binary links it (checked with ldd, so a change of build flavour cannot break an interpreter). ci image version 0.2.26 -> 0.2.27. CLAUDE.md notes the layer-size rule and why this exists.

Why

#219 merged, and the ci 0.2.26 image build on main (run 4165) built fine (Python 3.11.18, 3.13.18 and 3.14.10 ran, ansible 2.22.0, collections and pre-commit OK) but the push failed: PATCH .../blobs/uploads/...: 413 Request Entity Too Large from Cloudflare. The build's own size line for the /opt/python layer was 99.1 MB compressed (the registry stores about 9% more than that figure, limit 95 MiB), with three interpreters. I had estimated about 20 MB per extra interpreter; it is about 33 MB. Each interpreter ships a ~33 MB libpython<MINOR>.so (10 MB compressed) next to a statically linked python binary that does not use it.

Until this merges, every push to main retries the 0.2.26 build and fails. The published ci 0.2.25 is untouched, so Lint, Build and Molecule keep working. 0.2.26 was never published; the version moves to 0.2.27 because check_image_versions.py bump requires a new number for a changed Dockerfile.

Verified

  • Ran the exact Dockerfile step against local uv-installed copies of 3.11, 3.13 and 3.14: /opt/python 95.8 MB -> 67.7 MB compressed (the CI figure was 99.1 MB for the same content, so expect about 70 MB there).
  • All three interpreters still import ssl, sqlite3, venv after the step; a venv built from a stripped 3.14 runs pip.
  • ldd of the python3.14 binary shows no libpython dependency.
  • 193 script tests, check_image_versions.py pins and bump origin/main pass; all pre-commit hooks and the push-time ansible-test sanity pass.

Not verified

  • The registry push itself: it runs only on main, never on PRs. Expected margin is about 25 MB under the limit; check the Images run after merge, and the printed MB compressed /opt/python line.
  • Remaining kaniko and CA-certificate behaviour of the 3.14 venv: the 0.2.26 build log shows the venv steps, ansible-galaxy collection install and ansible-test sanity --prime-venvs all passed, so those are no longer open.

After merge

Renovate should open the pin-follow PR moving lint.yml, build.yml and molecule.yml to ci:0.2.27@sha256:...; then run the Renovate workflow via workflow_dispatch (dry run) to confirm a lock refresh keeps the 3.14 header and gets its image bump.

🤖 Generated with Claude Code

## What `images/ci/Dockerfile` removes `lib/libpython<MINOR>.so*` from each baked python-build-standalone interpreter (3.11, 3.13 and the pinned `PYTHON_VERSION`), unless that interpreter's `python` binary links it (checked with `ldd`, so a change of build flavour cannot break an interpreter). `ci` image version 0.2.26 -> 0.2.27. `CLAUDE.md` notes the layer-size rule and why this exists. ## Why #219 merged, and the `ci` 0.2.26 image build on `main` (run 4165) built fine (Python 3.11.18, 3.13.18 and 3.14.10 ran, `ansible` 2.22.0, collections and pre-commit OK) but the push failed: `PATCH .../blobs/uploads/...: 413 Request Entity Too Large` from Cloudflare. The build's own size line for the `/opt/python` layer was **99.1 MB compressed** (the registry stores about 9% more than that figure, limit 95 MiB), with three interpreters. I had estimated about 20 MB per extra interpreter; it is about 33 MB. Each interpreter ships a ~33 MB `libpython<MINOR>.so` (10 MB compressed) next to a statically linked `python` binary that does not use it. Until this merges, every push to `main` retries the 0.2.26 build and fails. The published `ci` 0.2.25 is untouched, so Lint, Build and Molecule keep working. 0.2.26 was never published; the version moves to 0.2.27 because `check_image_versions.py bump` requires a new number for a changed Dockerfile. ## Verified - Ran the exact Dockerfile step against local uv-installed copies of 3.11, 3.13 and 3.14: `/opt/python` 95.8 MB -> 67.7 MB compressed (the CI figure was 99.1 MB for the same content, so expect about 70 MB there). - All three interpreters still import `ssl`, `sqlite3`, `venv` after the step; a venv built from a stripped 3.14 runs `pip`. - `ldd` of the `python3.14` binary shows no libpython dependency. - 193 script tests, `check_image_versions.py pins` and `bump origin/main` pass; all pre-commit hooks and the push-time `ansible-test sanity` pass. ## Not verified - The registry push itself: it runs only on `main`, never on PRs. Expected margin is about 25 MB under the limit; check the Images run after merge, and the printed `MB compressed /opt/python` line. - Remaining kaniko and CA-certificate behaviour of the 3.14 venv: the 0.2.26 build log shows the venv steps, `ansible-galaxy collection install` and `ansible-test sanity --prime-venvs` all passed, so those are no longer open. ## After merge Renovate should open the pin-follow PR moving `lint.yml`, `build.yml` and `molecule.yml` to `ci:0.2.27@sha256:...`; then run the Renovate workflow via `workflow_dispatch` (dry run) to confirm a lock refresh keeps the 3.14 header and gets its image bump. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Claude added 1 commit 2026-11-16 08:27:29 +00:00
fix(image): drop the unused libpython shared libraries from the ci image
Build / build (pull_request) Successful in 12s
Lint / lint (pull_request) Successful in 31s
Molecule / molecule (pull_request) Successful in 1s
cf5f4b596c
The ci 0.2.26 build succeeded but its push got HTTP 413 from Cloudflare: the
/opt/python layer, now three baked interpreters (3.11, 3.13, 3.14), was 99.1 MB
compressed (the registry stores about 9% more), over the 95 MiB limit. Each
python-build-standalone interpreter ships a ~33 MB lib/libpython<MINOR>.so
next to a statically linked python binary that does not use it. Remove it
unless the binary links it. /opt/python goes from 95.8 to 67.7 MB compressed
in a local run; all three interpreters still import ssl, sqlite3 and venv.
ci image 0.2.26 (never published) -> 0.2.27.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNmHMc85bomfevwUDG
Defame1297 merged commit c77474d2c5 into main 2026-11-16 08:29:36 +00:00
Defame1297 deleted branch fix/ci-image-layer-size 2026-11-16 08:29:36 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#220