Skip to content

ci: 用 GitHub Actions 构建并推送发布镜像 - #11

Open
binyangzhu000-sudo wants to merge 1 commit into
mainfrom
ci/docker-image-build
Open

binyangzhu000-sudo wants to merge 1 commit into
mainfrom
ci/docker-image-build

Conversation

@binyangzhu000-sudo

Copy link
Copy Markdown
Contributor

为什么

这个仓没有构建流水线——唯一的 workflow 是同步模型目录。所以至今每个镜像都是在跳板机上手工 docker build 出来的,标签是 20260910-preview-logs 这样的日期串。

两个后果:

  1. 线上跑的是哪份代码查不出来。 日期串对应不到任何一次提交。
  2. dev 和生产会共用同一个标签。 谁重建一次,两边一起变。09-09 dev 上 aiproxy 被连发四版覆盖、OAuth 整条断掉,就是这类问题。

怎么做

照官网那条 workflow 的模式,包括它的 runner 选择:构建放 GitHub 托管 runner,不要换成自建那台——机房出网 DNS 丢包,登录 registry.atlascloud.ai 时解析 dockerauth-*.aliyuncs.com 会反复 i/o timeout(2026-08 运维确认)。这个 job 只需要公网。

两个门禁保证镜像可追溯,这也是打 tag 的全部意义:

  • 标签必须形如 vX.Y.Z
  • 标签必须和 package.jsonversion 一致

对不上就报错并给出该改哪一行,而不是推出一个名字说明不了内容的镜像。

触发与凭据

触发只有两个:push 一个 v* 标签,或手动 dispatch。两者都要求对本仓有写权限——本仓是公开仓,fork 的 PR 绝不能碰到 registry 凭据

凭据放在 production 环境而不是仓库级,理由同上:sync-models 和以后新增的任何 workflow 都读不到它们。

合并后需要在 Settings → Environments → production 里加:

类型 名称
Variable DOCKER_REGISTRY registry.atlascloud.ai
Secret DOCKER_USERNAME 同官网仓那一套
Secret DOCKER_PASSWORD 同官网仓那一套

范围

只构建和推送,不部署。 部署仍走 deploy/kubernetes/ 的 kustomize,所以这里不需要任何集群凭据。运行摘要会打印标签和 digest,直接复制进 production overlay 即可。

🤖 Generated with Claude Code

This repo had no build pipeline - the only workflow syncs the model catalog -
so every image so far was built by hand on the jump host and tagged with a date
slug like 20260910-preview-logs. Nothing ties such an image back to a commit,
and the same tag was serving dev, so rebuilding it moved production too.

Follows the pattern already proven on the website repo, including its runner
choice: the build stays on a GitHub-hosted runner because the self-hosted one
loses DNS packets on egress and the login to registry.atlascloud.ai fails
resolving dockerauth-*.aliyuncs.com. This job only needs the public internet.

Two gates make the image traceable, which is the whole point of tagging:
the tag must look like vX.Y.Z, and it must match package.json's version. A
mismatch fails with the exact edit to make rather than publishing an image
whose name says nothing about what is inside it.

Triggers are a v* tag push and a manual dispatch, both of which require write
access - this repo is public, so a fork's pull request must never reach the
registry credentials. Those live in the production environment rather than at
repo level for the same reason: sync-models and anything added later cannot
read them.

Build and push only. Deployment stays with kustomize in deploy/kubernetes, so
no cluster credential is needed here. The run summary prints the tag and the
digest for pasting into the production overlay.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant