From 4c756e9156e6eba75c3a8c8ae51f49db362e47b8 Mon Sep 17 00:00:00 2001 From: sagit Date: Fri, 6 Feb 2026 09:59:49 +0000 Subject: [PATCH] chore: align compose image tags with installer release version --- docker-compose-v4.yml | 4 ++-- docker-compose-v6.yml | 4 ++-- panel_install.sh | 42 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/docker-compose-v4.yml b/docker-compose-v4.yml index 81fff43..c0d3527 100644 --- a/docker-compose-v4.yml +++ b/docker-compose-v4.yml @@ -1,6 +1,6 @@ services: backend: - image: ghcr.io/sagit-chu/springboot-backend:2.0.7-beta + image: ghcr.io/sagit-chu/springboot-backend:${FLUX_VERSION:-latest} container_name: springboot-backend restart: unless-stopped logging: @@ -29,7 +29,7 @@ services: start_period: 60s frontend: - image: ghcr.io/sagit-chu/vite-frontend:2.0.7-beta + image: ghcr.io/sagit-chu/vite-frontend:${FLUX_VERSION:-latest} container_name: vite-frontend restart: unless-stopped logging: diff --git a/docker-compose-v6.yml b/docker-compose-v6.yml index 8694a25..ec791e9 100644 --- a/docker-compose-v6.yml +++ b/docker-compose-v6.yml @@ -1,6 +1,6 @@ services: backend: - image: ghcr.io/sagit-chu/springboot-backend:2.0.7-beta + image: ghcr.io/sagit-chu/springboot-backend:${FLUX_VERSION:-latest} container_name: springboot-backend restart: unless-stopped logging: @@ -29,7 +29,7 @@ services: start_period: 60s frontend: - image: ghcr.io/sagit-chu/vite-frontend:2.0.7-beta + image: ghcr.io/sagit-chu/vite-frontend:${FLUX_VERSION:-latest} container_name: vite-frontend restart: unless-stopped logging: diff --git a/panel_install.sh b/panel_install.sh index 21f8ade..dd9af9e 100755 --- a/panel_install.sh +++ b/panel_install.sh @@ -78,11 +78,16 @@ resolve_version() { return 1 } +# 根据版本号设置 compose 下载地址 +set_compose_urls_by_version() { + local version="$1" + DOCKER_COMPOSEV4_URL=$(maybe_proxy_url "https://github.com/${REPO}/releases/download/${version}/docker-compose-v4.yml") + DOCKER_COMPOSEV6_URL=$(maybe_proxy_url "https://github.com/${REPO}/releases/download/${version}/docker-compose-v6.yml") +} + # 全局下载地址配置(默认获取最新版本;也可用 VERSION=... 覆盖) RESOLVED_VERSION=$(resolve_version) || exit 1 - -DOCKER_COMPOSEV4_URL=$(maybe_proxy_url "https://github.com/${REPO}/releases/download/${RESOLVED_VERSION}/docker-compose-v4.yml") -DOCKER_COMPOSEV6_URL=$(maybe_proxy_url "https://github.com/${REPO}/releases/download/${RESOLVED_VERSION}/docker-compose-v6.yml") +set_compose_urls_by_version "$RESOLVED_VERSION" @@ -221,6 +226,27 @@ generate_random() { LC_ALL=C tr -dc 'A-Za-z0-9' "$tmp_file" + else + printf '%s=%s\n' "$key" "$value" > "$tmp_file" + fi + + mv "$tmp_file" "$file" +} + # 删除脚本自身 delete_self() { echo "" @@ -268,6 +294,7 @@ install_panel() { JWT_SECRET=$JWT_SECRET FRONTEND_PORT=$FRONTEND_PORT BACKEND_PORT=$BACKEND_PORT +FLUX_VERSION=$RESOLVED_VERSION EOF echo "🚀 启动 docker 服务..." @@ -288,6 +315,15 @@ update_panel() { echo "🔄 开始更新面板..." check_docker + echo "🔍 获取最新版本号..." + LATEST_VERSION=$(resolve_latest_release_tag) || { + echo "❌ 无法获取最新版本号,更新终止" + return 1 + } + echo "🆕 最新版本:$LATEST_VERSION" + set_compose_urls_by_version "$LATEST_VERSION" + upsert_env_var ".env" "FLUX_VERSION" "$LATEST_VERSION" + echo "🔽 下载最新配置文件..." DOCKER_COMPOSE_URL=$(get_docker_compose_url) echo "📡 选择配置文件:$(basename "$DOCKER_COMPOSE_URL")"