fix(deploy): auto-restart services after rebuild

Rebuild command now automatically restarts the service(s) to use
the newly built image.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-24 18:51:45 -08:00
parent 8e2c44edd0
commit 45a594d39a
1 changed files with 9 additions and 1 deletions

View File

@ -604,6 +604,10 @@ do_rebuild() {
if [ "$target" = "all" ]; then
log_step "重新构建所有服务镜像 (--no-cache)..."
$DOCKER_COMPOSE build --no-cache
# 重启所有后端服务
log_step "重启所有后端服务..."
$DOCKER_COMPOSE up -d user-service payment-service knowledge-service conversation-service evolution-service
else
# 获取服务名
local service_name=""
@ -620,9 +624,13 @@ do_rebuild() {
log_step "重新构建 $target 镜像 (--no-cache)..."
$DOCKER_COMPOSE build --no-cache "$service_name"
# 重启服务使用新镜像
log_step "重启 $target 服务..."
$DOCKER_COMPOSE up -d "$service_name"
fi
log_success "镜像重新构建完成"
log_success "镜像重新构建并重启完成"
}
# 启动入口