feat(deploy): add rebuild command with --no-cache support
Add do_rebuild function to rebuild Docker images without cache. Supports rebuilding individual services or all services at once. Usage: ./deploy.sh rebuild conversation # rebuild single service ./deploy.sh rebuild all # rebuild all services Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
aaf43155d9
commit
8e2c44edd0
38
deploy.sh
38
deploy.sh
|
|
@ -597,6 +597,34 @@ start_all() {
|
||||||
do_status
|
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() {
|
do_start() {
|
||||||
local target=${1:-all}
|
local target=${1:-all}
|
||||||
|
|
@ -1368,6 +1396,11 @@ show_help() {
|
||||||
conversation, user, payment, knowledge, evolution,
|
conversation, user, payment, knowledge, evolution,
|
||||||
web-client, admin-client
|
web-client, admin-client
|
||||||
|
|
||||||
|
rebuild [target] 重新构建 Docker 镜像 (--no-cache)
|
||||||
|
target: all, conversation, user, payment, knowledge, evolution,
|
||||||
|
nginx, kong
|
||||||
|
⚠️ 完全重新构建,忽略缓存
|
||||||
|
|
||||||
start [target] [mode] 启动服务
|
start [target] [mode] 启动服务
|
||||||
target: all, infra, kong, nginx, backend,
|
target: all, infra, kong, nginx, backend,
|
||||||
conversation, user, payment, knowledge, evolution,
|
conversation, user, payment, knowledge, evolution,
|
||||||
|
|
@ -1426,6 +1459,8 @@ show_help() {
|
||||||
./deploy.sh logs conversation 200 # 查看对话服务最近200行日志
|
./deploy.sh logs conversation 200 # 查看对话服务最近200行日志
|
||||||
./deploy.sh clean all # 清理所有构建产物和依赖
|
./deploy.sh clean all # 清理所有构建产物和依赖
|
||||||
./deploy.sh full-reset # ⚠️ 重置所有数据库数据
|
./deploy.sh full-reset # ⚠️ 重置所有数据库数据
|
||||||
|
./deploy.sh rebuild conversation # 重新构建对话服务镜像 (--no-cache)
|
||||||
|
./deploy.sh rebuild all # 重新构建所有服务镜像 (--no-cache)
|
||||||
./deploy.sh db init # 初始化数据库 (首次部署)
|
./deploy.sh db init # 初始化数据库 (首次部署)
|
||||||
./deploy.sh db backup # 备份数据库
|
./deploy.sh db backup # 备份数据库
|
||||||
./deploy.sh db migrate # 执行数据库迁移
|
./deploy.sh db migrate # 执行数据库迁移
|
||||||
|
|
@ -1459,6 +1494,9 @@ main() {
|
||||||
build)
|
build)
|
||||||
do_build "$@"
|
do_build "$@"
|
||||||
;;
|
;;
|
||||||
|
rebuild)
|
||||||
|
do_rebuild "$@"
|
||||||
|
;;
|
||||||
start)
|
start)
|
||||||
do_start "$@"
|
do_start "$@"
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue