build: NuGet cache mount + buildx registry cache
Build Docker Image / build (push) Failing after 16m15s
Build Docker Image / deploy (push) Has been skipped

Mirror the cache infra added to nas-auth (commit a1ecba3):
- Dockerfile: `RUN --mount=type=cache,target=/root/.nuget/packages`
  for restore + publish, with syntax 1.6 directive.
- workflow: cache-from/cache-to registry cache mode=max, so buildkit
  layer cache survives across CI runs (fresh buildkit per run otherwise).

First run after this still pays full cost; each subsequent run should
drop ~50% off dotnet restore.
This commit is contained in:
2026-05-17 00:35:15 +08:00
parent 37082e165d
commit a7688242a2
2 changed files with 9 additions and 2 deletions
+4
View File
@@ -70,6 +70,10 @@ jobs:
with:
context: .
push: true
# buildx 每次 CI 起新的 buildkit 实例,layer cache 默认会丢。用 registry
# 当跨 CI run 的缓存。mode=max 把所有中间层(含 NuGet restore 那层)都存。
cache-from: type=registry,ref=git.zhengchentao.win/zhengchen.tao/obsidian-mcp:buildcache
cache-to: type=registry,ref=git.zhengchentao.win/zhengchen.tao/obsidian-mcp:buildcache,mode=max
labels: |
org.opencontainers.image.source=https://git.zhengchentao.win/zhengchen.tao/obsidian-mcp
org.opencontainers.image.revision=${{ steps.meta.outputs.full_sha }}