diff --git a/deploy.sh b/deploy.sh index fcd0984..a6b99f9 100755 --- a/deploy.sh +++ b/deploy.sh @@ -597,6 +597,34 @@ start_all() { do_status } +# 重新构建 Docker 镜像 (--no-cache) +do_rebuild() { + local target=${1:-all} + + if [ "$target" = "all" ]; then + log_step "重新构建所有服务镜像 (--no-cache)..." + $DOCKER_COMPOSE build --no-cache + else + # 获取服务名 + local service_name="" + case $target in + user) service_name="user-service" ;; + payment) service_name="payment-service" ;; + knowledge) service_name="knowledge-service" ;; + conversation) service_name="conversation-service" ;; + evolution) service_name="evolution-service" ;; + nginx) service_name="nginx" ;; + kong) service_name="kong" ;; + *) service_name="$target-service" ;; + esac + + log_step "重新构建 $target 镜像 (--no-cache)..." + $DOCKER_COMPOSE build --no-cache "$service_name" + fi + + log_success "镜像重新构建完成" +} + # 启动入口 do_start() { local target=${1:-all} @@ -1368,6 +1396,11 @@ show_help() { conversation, user, payment, knowledge, evolution, web-client, admin-client + rebuild [target] 重新构建 Docker 镜像 (--no-cache) + target: all, conversation, user, payment, knowledge, evolution, + nginx, kong + ⚠️ 完全重新构建,忽略缓存 + start [target] [mode] 启动服务 target: all, infra, kong, nginx, backend, conversation, user, payment, knowledge, evolution, @@ -1426,6 +1459,8 @@ show_help() { ./deploy.sh logs conversation 200 # 查看对话服务最近200行日志 ./deploy.sh clean all # 清理所有构建产物和依赖 ./deploy.sh full-reset # ⚠️ 重置所有数据库数据 + ./deploy.sh rebuild conversation # 重新构建对话服务镜像 (--no-cache) + ./deploy.sh rebuild all # 重新构建所有服务镜像 (--no-cache) ./deploy.sh db init # 初始化数据库 (首次部署) ./deploy.sh db backup # 备份数据库 ./deploy.sh db migrate # 执行数据库迁移 @@ -1459,6 +1494,9 @@ main() { build) do_build "$@" ;; + rebuild) + do_rebuild "$@" + ;; start) do_start "$@" ;;