ci: remove Docker GHA cache in CI, lock release cache to fixed scope#95
Closed
ci: remove Docker GHA cache in CI, lock release cache to fixed scope#95
Conversation
Co-authored-by: jancwe <83763512+jancwe@users.noreply.github.com> Agent-Logs-Url: https://github.com/jancwe/formflow/sessions/a85ebc6d-ba25-4d3b-874b-cabc5e8131cc
Copilot
AI
changed the title
[WIP] Remove Docker BuildKit GHA cache from CI workflow
ci: remove Docker GHA cache in CI, lock release cache to fixed scope
Mar 22, 2026
jancwe
approved these changes
Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI Docker builds compete with release builds for the 10 GB GHA cache budget (~500 MB per run for apt/WeasyPrint layers), and PR branches regularly miss the cache anyway due to branch scoping and eviction — making the cache cost-without-benefit.
ci.yml— drop Docker BuildKit GHA cachecache-from: type=ghaandcache-to: type=gha,mode=maxfrom the Docker build step"Build formflow image"(no external cache used)pip installlayer is served from it as long asrequirements.txtis unchanged.venvactions/cacheblock retained — small (~50 MB), reliable, hash-keyed onrequirements*.txtrelease.yml— pin BuildKit cache to stable scopescope=buildkit-mainto bothcache-fromandcache-toThis gives the release cache a fixed key that CI runs can never evict, maximising cache hits on
mainbuilds where the cache actually pays off.Original prompt
Problem
Der aktuelle CI-Workflow (
ci.yml) nutztcache-from: type=gha/cache-to: type=gha,mode=maxfür den Docker-Build. Das belegt unnötig viel vom 10-GB GitHub Actions Cache-Budget (apt-get-Layer ~200 MB, WeasyPrint + Dependencies ~300 MB) und konkurriert mit dem Release-Workflow um Cache-Platz. Bei PR-Branches kommt es regelmäßig zu Cache-Misses (Branch-Scoping, Eviction), wodurch trotzdem alle Dependencies neu installiert werden – selbst wenn nur ein Bild getauscht wurde (siehe PR #94).Gewünschte Änderungen
1.
ci.yml– Docker BuildKit GHA-Cache entfernenIm Step "Build formflow image with cache":
cache-from: type=ghaentfernencache-to: type=gha,mode=maxentfernenDocker BuildKit nutzt innerhalb eines Runs trotzdem lokalen Layer-Cache. Der
pip install-Layer wird also lokal aus dem Layer-Cache bedient, solange sichrequirements.txtnicht geändert hat. Das reicht für CI-Zwecke.Der bestehende
actions/cache-Block für das.venv-Verzeichnis (pip-Pakete für pytest) soll beibehalten werden – er ist klein (~50 MB) und zuverlässig.2.
release.yml– Docker BuildKit GHA-Cache behalten und optimierenIm Step "Build and push Docker image":
cache-fromändern zu:type=gha,scope=buildkit-maincache-toändern zu:type=gha,mode=max,scope=buildkit-mainDurch den expliziten
scope=buildkit-mainwird sichergestellt, dass der Release-Cache konsistent unter einem festen Key liegt und nicht von CI-Runs verdrängt wird.Dateien die geändert werden müssen
.github/workflows/ci.yml–cache-fromundcache-toZeilen im Docker build-push-action Step entfernen, Step-Namen anpassen.github/workflows/release.yml–scope=buildkit-mainzucache-fromundcache-tohinzufügenErwartetes Ergebnis
mainprofitieren maximal vom GHA-Cache (mehr Budget, kein Verdrängen durch CI)The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Ich habe im letzten PR nur ein Bild getauscht. Trotzdem wurden alle dependencies aus den requirements neu installiert. War das wirklich notwendig, oder hätten wir das cachen sollen?
Assistant:
Gute Frage! Lass mich mir den letzten PR und die CI/CD-Konfiguration anschauen, um das zu beurteilen.
Assistant: Gute Frage! Kurze Antwort: Nein, die pip-Dependencies wurden bei reinen Bildänderungen nicht unnötig neu installiert. Dein Setup ist bereits gut aufgebaut. Hier die Analyse:
✅ CI-Workflow (
ci.yml) – Dependencies werden gecachtDein CI-Workflow hat bereits einen venv-Cache (Zeilen 34–41):
Der Cache-Key basiert auf
hashFiles('requirements.txt', 'requirements-dev.txt'). Da du in PR #94 nursrc/formflow/static/logo.pnggeändert hast, bleibt der Hash identisch → Cache-Hit →pip installwird übersprungen. ✅✅ Docker-Build – Ebenfalls gecacht
Der Docker-Build nutzt BuildKit mit GitHub Actions Cache (
cache-from: type=gha):Und dein
Dockerfileist korrekt in Layers aufgeteilt: