fix(ci): 修复registry不稳定导致镜像构建失败 - 解耦缓存推送 #357
Reference in New Issue
Block a user
Delete Branch "ci/registry-cache-stability-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
Worker镜像构建失败,错误为
use of closed network connection,发生在 buildx 推送缓存到 registry 阶段。根因:Gitea 内置 registry 在传输大缓存层时连接不稳定,长连接被断开。虽然镜像本身已构建完成,但缓存推送失败导致整个构建步骤失败。
修复方案
1. 构建与缓存解耦(核心修复)
创建
scripts/ci/docker_build_push.sh通用构建脚本:2. 缓存优化
mode=min+compression=zstd+oci-mediatypes=true减小传输体积3. 覆盖范围
全部6个镜像构建job(Staging/Production x API/Worker/Web)
验证
f55d574291toc94ce7c1e1c94ce7c1e1to446e3500f61058801264to99fa146a5cCI全绿,自动审批通过。