node构建慢
build / build (push) Successful in 13m54s

This commit is contained in:
wanghu
2026-10-19 09:55:29 +08:00
parent 44f85b2d48
commit 77a662d4fd
2 changed files with 86 additions and 84 deletions
+3 -1
View File
@@ -35,11 +35,13 @@ jobs:
# 前端构建:起独立 node 容器(通过 docker.sock 调宿主 dockerd)
# node:20 镜像预装 npm,npm ci 按 lockfile 安装依赖
# 挂载宿主 /data/ci-cache/npm 作为 npm 缓存:容器用完即毁,不挂卷则每次冷缓存全量下载 935 个包(此前构建慢的主因)
# 目录不存在时 docker 会自动创建;若 host 上手动清理过该目录,首轮构建会重新回源
- name: 构建前端(node 容器)
run: |
set -e
docker rm -f frontbuild 2>/dev/null || true
docker run -d --name frontbuild -w /build node:20 sleep 3600
docker run -d --name frontbuild -w /build -v /data/ci-cache/npm:/root/.npm node:20 sleep 3600
docker cp "${PWD}/." frontbuild:/build/
docker exec frontbuild sh -c '
set -e