ci: pin base images by digest resolved directly from Docker Hub
With the pkg-cache BuildKit mirror on, `FROM almalinux/10-base` was resolved by tag through the cache, so a compromised cache could substitute the image. Each job using the mirror now looks up the base tag's digest DIRECTLY at registry-1.docker.io (.gitea/scripts/resolve-base-image.sh, HTTPS, HEAD on the manifest, regex-validated) and builds FROM image@sha256:... via the BASE_IMAGE build-arg, so the mirror can only serve content-addressed blobs. If the lookup fails, the mirror is NOT used for that job and the tag is pulled straight from Docker Hub. The digest is resolved every run (no manual bumps); local builds default to the tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3334f94cd5
commit
d1547f3418
7 files changed
+201
-15
No files matched your search
@@ -1,4 +1,9 @@
|
||||
FROM almalinux/10-base
|
||||
# Base image. CI passes BASE_IMAGE=almalinux/10-base@sha256:<digest>, resolved
|
||||
# DIRECTLY from Docker Hub in the same run (.gitea/scripts/resolve-base-image.sh),
|
||||
# so the pkg-cache registry mirror can only serve content-addressed blobs.
|
||||
# Local builds use the tag. docs/pkg-cache.md "Base-image digest pinning".
|
||||
ARG BASE_IMAGE=almalinux/10-base
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
# OPTIONAL internal package cache, e.g. --build-arg PKG_CACHE=https://192.168.1.40
|
||||
# (CT130 pkg-cache, https only). Unset = upstream repositories. Release RPMs are
|
||||
|
||||
Reference in new issue
Block a user