ci: fix test worker and API upstream config
This commit is contained in:
+3
-1
@@ -17,7 +17,9 @@ RUN pnpm config set registry https://registry.npmmirror.com && \
|
||||
|
||||
COPY . .
|
||||
# Docker 构建时同机还会运行多项服务,限制 Vitest 并发以避免测试超时。
|
||||
RUN pnpm test -- --maxWorkers=1 && pnpm build
|
||||
# pnpm 会直接把脚本名后的参数传给 Vitest;额外的 `--` 会让 Vitest
|
||||
# 把 maxWorkers 当作位置参数,导致并发限制不生效。
|
||||
RUN pnpm test --maxWorkers=1 && pnpm build
|
||||
|
||||
# 运行阶段:仅保留构建产物和 Nginx,不包含源码或 node_modules。
|
||||
FROM nginx:1.27-alpine
|
||||
|
||||
@@ -12,4 +12,6 @@ services:
|
||||
- "host.docker.internal:host-gateway"
|
||||
environment:
|
||||
# Gateway 与前端容器在同一台测试服务器,通过宿主机内部地址访问。
|
||||
API_UPSTREAM: "${API_UPSTREAM:-http://host.docker.internal:9000}"
|
||||
# 测试环境固定走 Docker 宿主机网关,避免 Jenkins 全局环境变量或
|
||||
# 工作区残留配置把上游覆盖成公网 IP,造成容器回连公网端口失败。
|
||||
API_UPSTREAM: "http://host.docker.internal:9000"
|
||||
|
||||
Reference in New Issue
Block a user