Build a prebuilt CI image #10

Open
opened 2026-11-26 02:15:17 +01:00 by claude-bot · 1 comment

Check jobs currently install Python and the lint tools from the internet on every run. A prebuilt image makes runs faster and reproducible, and moves all downloads to one reviewed build.

Enterprise practice: golden runner images, built by CI, scanned, stored in an internal registry and referenced by digest.

Depends on #6 and #8.

Steps

  • Add ci/Dockerfile: pinned base image (digest), lint tools from the hash-locked requirements, Betterleaks and Trivy with checksums
  • Build it in a workflow that runs only on main when ci/** changes, and push it to Gitea's built-in container registry
  • Build without the Docker socket (see #5), for example with Buildah; verify that it works in a job container on the runner VM (no Docker socket, no privileged mode)
  • Scan the image with Trivy before pushing
  • Run the check jobs in it via container: <registry>/homelab-ci@sha256:..., and drop setup-python and the runtime installs
  • Let Renovate bump the digest (#7)

Tools

Gitea container registry, Buildah, Trivy.

Done when

Check jobs download nothing at run time, and the image they use is pinned by digest.

Check jobs currently install Python and the lint tools from the internet on every run. A prebuilt image makes runs faster and reproducible, and moves all downloads to one reviewed build. **Enterprise practice:** golden runner images, built by CI, scanned, stored in an internal registry and referenced by digest. Depends on #6 and #8. ## Steps - [ ] Add `ci/Dockerfile`: pinned base image (digest), lint tools from the hash-locked requirements, Betterleaks and Trivy with checksums - [ ] Build it in a workflow that runs only on `main` when `ci/**` changes, and push it to Gitea's built-in container registry - [ ] Build without the Docker socket (see #5), for example with Buildah; verify that it works in a job container on the runner VM (no Docker socket, no privileged mode) - [ ] Scan the image with Trivy before pushing - [ ] Run the check jobs in it via `container: <registry>/homelab-ci@sha256:...`, and drop `setup-python` and the runtime installs - [ ] Let Renovate bump the digest (#7) ## Tools Gitea container registry, Buildah, Trivy. ## Done when Check jobs download nothing at run time, and the image they use is pinned by digest.

Update: the new runner (#18) runs jobs in Docker containers instead of host mode, so container: <registry>/homelab-ci@sha256:... jobs will work on it. Jobs don't get the Docker socket (docker_host: "-"), so the "build without the Docker socket" step (e.g. Buildah) still applies.

Update: the new runner (#18) runs jobs in Docker containers instead of host mode, so `container: <registry>/homelab-ci@sha256:...` jobs will work on it. Jobs don't get the Docker socket (`docker_host: "-"`), so the "build without the Docker socket" step (e.g. Buildah) still applies.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kasun/homelab-ansible#10