Lint and Build install OS packages, the pinned Python tools and every pre-commit hook environment on each run (PR #1: Lint 86s, Build 50s, of which the Go toolchain download for gitleaks/actionlint alone was ~47s). This bakes them into git.rkdr.net/mortis/ci.
build: venv from requirements-dev.txt; Python 3.11 and 3.13 via uv (pinned uv==0.13.5; they make ansible-test sanity run its compile test instead of skipping it); pre-commit install-hooks from .pre-commit-config.yaml, then a yamllint run to prove the cache works. uv, pip caches and the Go build cache stay in the build stage.
final: base packages (git, shellcheck, python3, ca-certificates) + COPY --from=build of /opt/venv, /opt/python, /opt/pre-commit. Each is its own layer (Cloudflare caps a pushed layer at 100 MB).
/opt/ci-pins.sha256 records the checksums of the two pin files. A job can run sha256sum -c /opt/ci-pins.sha256 in its checkout and fall back to installing at run time when a PR changes a pin (PRs cannot build images).
image.yml: matrix over both images (max-parallel: 1), molecule-ubuntu2404 unchanged (sub-path context), ci with the repo root as context. Also triggers on requirements-dev.txt / .pre-commit-config.yaml changes.
Not in this PR
Nothing consumes the image yet. After merge image.yml builds it on main; that run shows the real layer sizes (the build stage prints them too) and the digest. A follow-up PR switches lint.yml / build.yml to that digest, with the drift fallback. Not baked yet: the ansible-test sanity --requirements per-test virtualenvs (about 25s of Build), which need a stub-collection prewarm; to be measured first.
Risks (unverifiable without a build)
A layer over 100 MB fails the push with 413. Most likely the pre-commit cache (Go toolchain). Fallback: delete the toolchain/module cache from the hook environments in the build stage.
pre-commit install-hooks in a kaniko RUN under Docker's default seccomp on the runner; the job container has a memory cap.
A failed build changes nothing in use: the molecule image is built first and the workflows still use ubuntu:24.04.
## Why
Lint and Build install OS packages, the pinned Python tools and every pre-commit hook environment on each run (PR #1: Lint 86s, Build 50s, of which the Go toolchain download for gitleaks/actionlint alone was ~47s). This bakes them into `git.rkdr.net/mortis/ci`.
## What
- `images/ci/Dockerfile`, multi-stage (`os` → `build` → `final`):
- **build**: venv from `requirements-dev.txt`; Python 3.11 and 3.13 via uv (pinned `uv==0.13.5`; they make `ansible-test sanity` run its compile test instead of skipping it); `pre-commit install-hooks` from `.pre-commit-config.yaml`, then a `yamllint` run to prove the cache works. uv, pip caches and the Go build cache stay in the build stage.
- **final**: base packages (git, shellcheck, python3, ca-certificates) + `COPY --from=build` of `/opt/venv`, `/opt/python`, `/opt/pre-commit`. Each is its own layer (Cloudflare caps a pushed layer at 100 MB).
- `/opt/ci-pins.sha256` records the checksums of the two pin files. A job can run `sha256sum -c /opt/ci-pins.sha256` in its checkout and fall back to installing at run time when a PR changes a pin (PRs cannot build images).
- `image.yml`: matrix over both images (`max-parallel: 1`), `molecule-ubuntu2404` unchanged (sub-path context), `ci` with the repo root as context. Also triggers on `requirements-dev.txt` / `.pre-commit-config.yaml` changes.
## Not in this PR
Nothing consumes the image yet. After merge `image.yml` builds it on `main`; that run shows the real layer sizes (the build stage prints them too) and the digest. A follow-up PR switches `lint.yml` / `build.yml` to that digest, with the drift fallback. Not baked yet: the `ansible-test sanity --requirements` per-test virtualenvs (about 25s of Build), which need a stub-collection prewarm; to be measured first.
## Risks (unverifiable without a build)
- A layer over 100 MB fails the push with 413. Most likely the pre-commit cache (Go toolchain). Fallback: delete the toolchain/module cache from the hook environments in the build stage.
- `pre-commit install-hooks` in a kaniko `RUN` under Docker's default seccomp on the runner; the job container has a memory cap.
- A failed build changes nothing in use: the molecule image is built first and the workflows still use `ubuntu:24.04`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lint and Build install OS packages, the pinned Python tools and every
pre-commit hook environment on each run (about 40s of the 50 to 86s). Bake
them into git.rkdr.net/mortis/ci instead:
- images/ci/Dockerfile, multi-stage: the build stage creates the venv from
requirements-dev.txt, installs Python 3.11 and 3.13 (uv, for the ansible-test
compile check that is skipped today) and runs `pre-commit install-hooks`
from .pre-commit-config.yaml; the final stage copies only the results.
Several layers, each meant to stay below Cloudflare's 100 MB request limit.
- The image records the sha256 of the two pin files it was built from
(/opt/ci-pins.sha256) so a job can detect drift and fall back to
installing at run time.
- image.yml builds both images in a matrix (molecule-ubuntu2404 unchanged,
ci with the repository root as build context) and also runs when the pin
files change.
Nothing consumes the image yet: the workflows switch to its digest in a
follow-up once the first build has shown the real layer sizes.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Matrix over both images. molecule-ubuntu2404 keeps its sub-path context;
ci uses the repository root as context (its Dockerfile copies the pin
files) and also rebuilds when requirements-dev.txt or
.pre-commit-config.yaml change.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MmzvM9skAvYcph2c9EiPcm
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why
Lint and Build install OS packages, the pinned Python tools and every pre-commit hook environment on each run (PR #1: Lint 86s, Build 50s, of which the Go toolchain download for gitleaks/actionlint alone was ~47s). This bakes them into
git.rkdr.net/mortis/ci.What
images/ci/Dockerfile, multi-stage (os→build→final):requirements-dev.txt; Python 3.11 and 3.13 via uv (pinneduv==0.13.5; they makeansible-test sanityrun its compile test instead of skipping it);pre-commit install-hooksfrom.pre-commit-config.yaml, then ayamllintrun to prove the cache works. uv, pip caches and the Go build cache stay in the build stage.COPY --from=buildof/opt/venv,/opt/python,/opt/pre-commit. Each is its own layer (Cloudflare caps a pushed layer at 100 MB)./opt/ci-pins.sha256records the checksums of the two pin files. A job can runsha256sum -c /opt/ci-pins.sha256in its checkout and fall back to installing at run time when a PR changes a pin (PRs cannot build images).image.yml: matrix over both images (max-parallel: 1),molecule-ubuntu2404unchanged (sub-path context),ciwith the repo root as context. Also triggers onrequirements-dev.txt/.pre-commit-config.yamlchanges.Not in this PR
Nothing consumes the image yet. After merge
image.ymlbuilds it onmain; that run shows the real layer sizes (the build stage prints them too) and the digest. A follow-up PR switcheslint.yml/build.ymlto that digest, with the drift fallback. Not baked yet: theansible-test sanity --requirementsper-test virtualenvs (about 25s of Build), which need a stub-collection prewarm; to be measured first.Risks (unverifiable without a build)
pre-commit install-hooksin a kanikoRUNunder Docker's default seccomp on the runner; the job container has a memory cap.ubuntu:24.04.🤖 Generated with Claude Code