ci: switch buildx cache-to to mode=min

mode=max was re-uploading the bun install cache mount (~40–60s per
build, ~90s combined for api-core + web) to the Gitea OCI registry
on every push, even when source hadn't changed. That single export
accounts for most of the delta between 1-minute and 3-minute deploys.

mode=min only exports the final stage's layers. The trade-off is a
few-second tax on cold buildkitd starts (the installer stage no
longer warms from registry cache), but the per-push savings dwarf it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 13:43:07 +02:00
parent f924ec7485
commit 6c46ca98a7
+10 -2
View File
@@ -80,8 +80,15 @@ jobs:
npmrc=/tmp/.npmrc npmrc=/tmp/.npmrc
cache-from: | cache-from: |
type=registry,ref=git.unom.io/${{ gitea.repository }}/api-core:cache type=registry,ref=git.unom.io/${{ gitea.repository }}/api-core:cache
# mode=min: export only the final stage's layers. mode=max
# was re-uploading the bun-install cache mount (~4060s) to
# the Gitea OCI registry on every push, even no-op deploys.
# Trade-off: a cold buildkitd will re-run `bun install` from
# scratch on the installer stage instead of importing it
# from registry cache — a few-second tax in exchange for
# not paying the export tax on every run.
cache-to: | cache-to: |
type=registry,ref=git.unom.io/${{ gitea.repository }}/api-core:cache,mode=max type=registry,ref=git.unom.io/${{ gitea.repository }}/api-core:cache,mode=min
deploy-api-core: deploy-api-core:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
@@ -196,8 +203,9 @@ jobs:
npmrc=/tmp/.npmrc npmrc=/tmp/.npmrc
cache-from: | cache-from: |
type=registry,ref=git.unom.io/${{ gitea.repository }}/web:cache type=registry,ref=git.unom.io/${{ gitea.repository }}/web:cache
# See the api-core cache-to block above for the mode=min rationale.
cache-to: | cache-to: |
type=registry,ref=git.unom.io/${{ gitea.repository }}/web:cache,mode=max type=registry,ref=git.unom.io/${{ gitea.repository }}/web:cache,mode=min
deploy-web: deploy-web:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04