ci: 预热 Prisma 并移除运行时 Node 下载
CI / Static checks (pull_request) Successful in 1m1s
CI / API integration (pull_request) Successful in 1m26s
CI / Production build (pull_request) Successful in 1m45s
CI / Browser smoke (pull_request) Successful in 50s

This commit is contained in:
que01 committed 2026-10-23 17:37:48 +08:00
1 parent 12a3bf2f3b
commit 447c224fce
4 files changed
+72 -22

No files matched your search

+10
View File
@@ -6,6 +6,8 @@ FROM node:24-bookworm
ARG PNPM_VERSION=9.15.0
ARG PLAYWRIGHT_VERSION=1.58.2
# 必须与 pnpm-lock.yaml 中解析出的 Prisma 版本一致;升级 Prisma 后同步修改并重建镜像。
ARG PRISMA_VERSION=6.19.3
ENV PNPM_HOME=/usr/local/share/pnpm
ENV PATH=${PNPM_HOME}:${PATH}
@@ -22,4 +24,12 @@ RUN corepack enable \
RUN npx --yes playwright@${PLAYWRIGHT_VERSION} install --with-deps chromium \
&& rm -rf /var/lib/apt/lists/*
# 预热 Prisma engines 到 /root/.cache/prisma。CI job 每次都是新容器,若不预热,
# 每个 job 的 prisma generate 都会重新访问 binaries.prisma.sh,网络抖动会直接拖垮 CI。
COPY apps/api/prisma/schema.prisma /tmp/prisma-warmup/schema.prisma
RUN printf '%s\n' '{"name":"prisma-warmup","private":true}' > /tmp/prisma-warmup/package.json \
&& cd /tmp/prisma-warmup \
&& DATABASE_URL=postgresql://warmup:warmup@127.0.0.1:5432/warmup npx --yes prisma@${PRISMA_VERSION} generate --schema schema.prisma \
&& rm -rf /tmp/prisma-warmup /root/.npm
WORKDIR /workspace