fix: avoid Docker Hub timeout in Gitea builds
Staging Backend Quality Gate (push the reviewed main SHA to staging to auto-deploy) / validate (push) Failing after 9m1s
Staging Backend Quality Gate (push the reviewed main SHA to staging to auto-deploy) / publish-and-deploy (push) Has been skipped

This commit is contained in:
linmeng
2026-07-28 09:37:32 +08:00
parent f711e77849
commit 7a36169f5d
4 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM python:3.12-slim
FROM registry.cn-hangzhou.aliyuncs.com/library/python:3.12-slim
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
+1 -1
View File
@@ -1,4 +1,4 @@
FROM node:22-alpine
FROM registry.cn-hangzhou.aliyuncs.com/library/node:22-alpine
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
+16
View File
@@ -1535,3 +1535,19 @@
- 相关记录:BUG-082
- 复发自:BUG-082
- 修复版本:待提交(本地可测)
## BUG-084 | Gitea Runner 构建镜像访问 Docker Hub 超时
- 状态:resolved
- 首次发现:2026-07-28
- 最近更新:2026-07-28
- 影响面:Gitea staging 镜像构建与发布
- 用户现象:镜像构建在解析 `python:3.12-slim` 基础镜像时访问 `registry-1.docker.io` 超时,退出码为 1;代码检出、镜像仓库登录均已成功。
- 触发条件:xiaoxin Runner 构建 `deploy/railway-api.Dockerfile``deploy/railway-web.Dockerfile`,且到 Docker Hub 的 HTTPS 连接不可用或不稳定。
- 根因:Railway API/Web Dockerfile 直接依赖 Docker Hub 官方 registry;本次失败发生在 Dockerfile 第 1 行的基础镜像 metadata 拉取阶段,不是应用代码、依赖安装或 ACR 登录失败。
- 修复:将 API 的 Python 基础镜像和 Web 的 Node 基础镜像切换为可从当前网络稳定访问的阿里云公共镜像同步地址;增加 Dockerfile 契约断言,防止后续恢复为 Docker Hub 直连。
- 验证:`tests/test_railway_deployment.py` 的静态契约已更新;当前本机 pytest 7.4.4 低于项目要求的 pytest 8.0,测试执行被项目配置门禁阻断,未伪报通过。
- 防复发:镜像构建前必须验证基础镜像 registry 可达;统一基础镜像来源,不要在受限 Runner 上直接依赖 Docker Hub;若镜像同步源发生变更,应先更新契约和执行实际构建验证。
- 相关记录:BUG-082、BUG-083
- 复发自:无
- 修复版本:待提交(本地可测)
+3
View File
@@ -12,10 +12,13 @@ def test_railway_services_use_the_product_frontend_and_dynamic_ports() -> None:
assert "--hostname 0.0.0.0" in web and "${PORT:-3000}" in web
assert "next-env.d.ts" not in web
assert "FROM registry.cn-hangzhou.aliyuncs.com/library/python:3.12-slim" in api
assert "COPY SKILL.md mcp_server.py" in api
assert "--host 0.0.0.0" in api and "${PORT:-5200}" in api
assert "http.server" not in api
assert "FROM registry.cn-hangzhou.aliyuncs.com/library/node:22-alpine" in web
def test_web_image_copies_postcss_config_before_building_frontend() -> None:
web = (ROOT / "deploy" / "railway-web.Dockerfile").read_text(encoding="utf-8")