build: NuGet cache mount + buildx registry cache
Mirror the cache infra added to nas-auth (commit a1ecba3) and obsidian-mcp. Same pattern: --mount=type=cache for restore+publish in Dockerfile, registry cache mode=max in workflow.
This commit is contained in:
+5
-2
@@ -1,3 +1,4 @@
|
||||
# syntax=docker/dockerfile:1.6
|
||||
# ── Stage 1: build ──────────────────────────────────────────────
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS builder
|
||||
|
||||
@@ -5,11 +6,13 @@ WORKDIR /src
|
||||
|
||||
# 先复制 csproj,单独 restore(利用层缓存)
|
||||
COPY gitea-mcp.csproj .
|
||||
RUN dotnet restore gitea-mcp.csproj
|
||||
RUN --mount=type=cache,target=/root/.nuget/packages \
|
||||
dotnet restore gitea-mcp.csproj
|
||||
|
||||
# 复制剩余源码并发布
|
||||
COPY . .
|
||||
RUN dotnet publish gitea-mcp.csproj \
|
||||
RUN --mount=type=cache,target=/root/.nuget/packages \
|
||||
dotnet publish gitea-mcp.csproj \
|
||||
-c Release \
|
||||
-o /app/publish \
|
||||
--no-restore
|
||||
|
||||
Reference in New Issue
Block a user