Publish verified Docker images to GHCR

Make deployments pull immutable CI-built images while keeping test failures diagnosable before any package is published.
This commit is contained in:
Rocky
2026-08-16 14:56:36 +08:00
parent 0af35d44f4
commit 41e2145334
7 changed files with 74 additions and 16 deletions
+8 -4
View File
@@ -99,12 +99,16 @@ v3 WSS endpoint、资源 ID 和 API KeyDeepSeek 使用 HTTPS endpoint、已
## 5. 构建与启动
先检查变量插值。`docker compose config` 会展开秘密,不要把输出上传或粘贴到工单:
GitHub CI 在测试通过后发布私有镜像
`ghcr.io/hkgood/osg-account-server`。先使用仅有 `read:packages` 权限的部署令牌登录 GHCR
令牌不要写入 `.env`、Compose、1Panel 截图或 shell 历史。然后检查变量插值并拉取镜像。
`docker compose config` 会展开秘密,不要把输出上传或粘贴到工单:
```bash
./gradlew test
echo "$GHCR_TOKEN" | docker login ghcr.io -u hkgood --password-stdin
docker compose config --quiet
docker compose build --pull
docker compose pull
docker compose up -d
docker compose ps
curl --fail http://127.0.0.1:18080/health/ready
@@ -175,8 +179,8 @@ curl -i https://osglab.com/i/AbCdEf0123456789_-AbCd
更新前备份 MySQL 并记录当前镜像标签。使用不可变标签构建:
```bash
IMAGE_TAG=<release-tag> docker compose build
IMAGE_TAG=<release-tag> docker compose up -d
IMAGE_TAG=sha-<commit> docker compose pull
IMAGE_TAG=sha-<commit> docker compose up -d
```
Flyway 迁移只向前执行。若新版本包含数据库迁移,应用镜像回滚不等于数据库回滚;应先按迁移影响