fix(deploy): 修复数据库初始化复用旧镜像

This commit is contained in:
Cheng Zhou
2026-07-01 11:15:55 +08:00
parent 9cac75e85c
commit 5ee84c97e8
4 changed files with 13 additions and 7 deletions
+7 -1
View File
@@ -325,7 +325,13 @@ run_compose_config() {
run_backend_init() {
step "初始化数据库与管理员账号"
ctms_run_quiet "运行 backend-init 容器" -- compose_cmd run --rm backend-init
if [[ "$SKIP_BUILD" -eq 1 ]]; then
ctms_run_quiet "运行 backend-init 容器" -- compose_cmd run --rm backend-init
else
# backend-init 是 profile 服务,不会被后续 `compose up --build` 自动构建。
# 更新部署时必须先基于当前代码重建,否则会复用旧镜像并缺失新 Alembic revision。
CTMS_LIVE_OUTPUT=1 ctms_run_quiet "构建并运行 backend-init 容器" -- compose_cmd run --rm --build backend-init
fi
}
run_build_and_start() {