From c9839b265c9a16e06fcce1f29b08fd7ebd733f68 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Sat, 18 Jul 2026 15:59:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20Web=E6=9E=84=E5=BB=BA=E6=94=B9?= =?UTF-8?q?=E7=94=A8layer=E7=BC=93=E5=AD=98=E6=9B=BF=E4=BB=A3cache=20mount?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8Dnode=5Fmodules=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=8D=9F=E5=9D=8F=E5=AF=BC=E8=87=B4=E6=9E=84=E5=BB=BA=E5=85=A8?= =?UTF-8?q?=E6=8C=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除node_modules的cache mount,改为写入镜像layer走ACR缓存 - 保留/root/.npm cache mount加速下载(不影响正确性) - 保留.tscache cache mount加速TS增量编译(坏了不影响构建) - layer缓存由ACR跨runner共享,内容完整性由layer哈希保证 --- infra/docker/web.Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/infra/docker/web.Dockerfile b/infra/docker/web.Dockerfile index f800ed684..12fe02505 100755 --- a/infra/docker/web.Dockerfile +++ b/infra/docker/web.Dockerfile @@ -8,10 +8,9 @@ ENV VITE_API_URL=$VITE_API_URL COPY apps/web/package.json apps/web/package-lock.json ./apps/web/ WORKDIR /app/apps/web -# 安装依赖:用BuildKit cache mount缓存npm下载和node_modules -# sharing=locked 防止并发构建竞争写缓存 +# 安装依赖:node_modules写入镜像layer,走ACR缓存保证完整性 +# /root/.npm 保留cache mount加速下载(不影响构建正确性) RUN --mount=type=cache,target=/root/.npm,sharing=locked \ - --mount=type=cache,target=/app/apps/web/node_modules,sharing=locked \ npm config set registry https://registry.npmmirror.com \ && npm ci @@ -19,8 +18,8 @@ RUN --mount=type=cache,target=/root/.npm,sharing=locked \ COPY apps/web/ ./ # 构建:TS增量编译 + Vite构建,tsbuildinfo用cache mount持久化 -RUN --mount=type=cache,target=/app/apps/web/node_modules,sharing=locked \ - --mount=type=cache,target=/app/apps/web/.tscache,sharing=locked \ +# node_modules直接使用镜像中已安装的(layer缓存保证完整性) +RUN --mount=type=cache,target=/app/apps/web/.tscache,sharing=locked \ mkdir -p .tscache \ && npx tsc --incremental --tsBuildInfoFile .tscache/tsconfig.tsbuildinfo \ && npx vite build -- 2.54.0