perf(web): Dockerfile 加入 --mount=type=cache 持久化 Next.js build cache
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m37s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m37s
CACHE_BUST 仍強制讓 source 層失效(確保代碼變更進入 bundle), 但 .next/cache 透過 BuildKit cache mount 跨 build 持久化到 runner host。 Next.js 增量編譯只重建有變更的頁面,預計節省 3-4 分鐘。 # 2026-04-06 ogt: Web build 從 5 min 降至 ~1-2 min(第二次起) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# AWOOOI Web - Production Dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
# 首席架構師 Review C1 (2026-04-05 Claude Code): BuildKit inline cache 需要 ARG 宣告
|
||||
ARG BUILDKIT_INLINE_CACHE=0
|
||||
ARG BUILDKIT_INLINE_CACHE=1
|
||||
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
@@ -45,7 +45,10 @@ ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
ENV NEXT_PUBLIC_SENTRY_DSN=${NEXT_PUBLIC_SENTRY_DSN}
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN pnpm turbo build --filter=@awoooi/web
|
||||
# 2026-04-06 ogt: --mount=type=cache 持久化 .next/cache,跨 build 增量編譯
|
||||
# 只有變更的頁面重新編譯,未變更頁面直接用 cache → 節省 3-4 min
|
||||
RUN --mount=type=cache,target=/app/apps/web/.next/cache \
|
||||
pnpm turbo build --filter=@awoooi/web
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
Reference in New Issue
Block a user