Files
UserhomeFront/.gitea/workflows
chenxing c3fbfeefa8
build / build (push) Successful in 4m16s
ci(build): 前端构建挂宿主 npm 缓存卷 + 切国内镜像源,治 CI 13 分钟慢
- 实测 build #10 耗时 13分5秒,其中 npm install 占 12分46秒(97.6%,added 754 packages in 13m),
  vite build 仅 16.53s —— 瓶颈唯一且固定在依赖安装
- 根因:① 每次起全新 node:20 容器、装完即 rm -f,node_modules 零缓存;
  ② .npmrc / yarn.lock 均被 .gitignore 忽略 ⇒ CI 走公网 registry.npmjs.org 跨境下载 + 无 lock 全量解析
- 修复(照 notice/service 的 m2 缓存做法):
  - 挂 -v /opt/docker/projman-npm-cache:/root/.npm,npm 缓存落宿主、跨构建复用
  - npm config set registry https://registry.npmmirror.com,跨境改境内
  - npm install 加 --prefer-offline,优先命中宿主缓存
- 预期 13min → 3~5min;首次构建缓存为空不改善,第二次起见效
2026-09-30 10:01:10 +08:00
..