Skip to content

chore(build): re-run OS package upgrades on every image build#218

Merged
jfrench9 merged 1 commit into
mainfrom
chore/os-package-refresh
Jul 22, 2026
Merged

chore(build): re-run OS package upgrades on every image build#218
jfrench9 merged 1 commit into
mainfrom
chore/os-package-refresh

Conversation

@jfrench9

Copy link
Copy Markdown
Member

Summary

Ensures OS-level security patches actually land in every image build. The runner stage runs apk upgrade --no-cache, but with GHA layer caching (--cache-from type=gha) that layer is reused from cache and never re-executes — upgrades only landed when the base image digest happened to move. This is why the image scanner kept reporting OS package findings that a fresh build would have cleared.

Changes

Dockerfile

  • Adds an ARG CACHE_DATE consumed at the start of the runner stage's apk upgrade layer, so a changed value invalidates the layer (and everything after it, including the npm install -g npm@latest refresh).

.github/workflows/build.yml

  • Passes --build-arg CACHE_DATE=$(date -u +%Y%m%d) to the buildx invocation — the layer re-runs on the first build of each UTC day; same-day rebuilds keep full cache benefit.

Testing

  • Pre-commit gate (format, lint, typecheck, tests, cf-lint) green. The behavior change itself is exercised by the next image build; current open image-scan findings will close once a fresh image is built, scanned, and deployed.

The runner stage's apk upgrade layer was served from the GHA build
cache, so security patches only landed when the base image digest
moved. A per-build CACHE_DATE arg now busts that layer daily.
@jfrench9
jfrench9 merged commit 86903a6 into main Jul 22, 2026
3 checks passed
@jfrench9
jfrench9 deleted the chore/os-package-refresh branch July 22, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant