From d52773ebd697aa8319694ea84125b496e4461e89 Mon Sep 17 00:00:00 2001 From: kyx236 Date: Fri, 30 Jan 2026 07:51:59 +0800 Subject: [PATCH] build: Add cache mounts to Dockerfile for faster Go binary compilation. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7d8fb13..6b89dd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,8 +51,10 @@ COPY backend/ ./ # Copy frontend dist from previous stage COPY --from=frontend-builder /app/frontend/dist ./internal/web/dist -# Build the binary with embed tag -RUN GOTOOLCHAIN=auto CGO_ENABLED=1 GOOS=linux go build \ +# Build the binary with embed tag (使用缓存加速) +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ + GOTOOLCHAIN=auto CGO_ENABLED=1 GOOS=linux go build \ -tags embed \ -ldflags="-s -w" \ -o /app/codex-pool \