diff --git a/frontend/admin-web/scripts/build.sh b/frontend/admin-web/scripts/build.sh new file mode 100644 index 00000000..a87fe94c --- /dev/null +++ b/frontend/admin-web/scripts/build.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# 构建 Docker 镜像 +set -e +cd "$(dirname "$0")/.." +echo "🔨 构建 Docker 镜像..." +docker compose build --no-cache +echo "✅ 构建完成" diff --git a/frontend/admin-web/scripts/clean.sh b/frontend/admin-web/scripts/clean.sh new file mode 100644 index 00000000..1d78ae38 --- /dev/null +++ b/frontend/admin-web/scripts/clean.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# 清理容器、镜像和卷 +set -e +cd "$(dirname "$0")/.." +echo "🧹 清理容器和镜像..." +docker compose down --rmi local --volumes --remove-orphans +docker image prune -f +echo "✅ 清理完成" diff --git a/frontend/admin-web/scripts/deploy.sh b/frontend/admin-web/scripts/deploy.sh new file mode 100644 index 00000000..1366b2b7 --- /dev/null +++ b/frontend/admin-web/scripts/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# 一键部署 (构建 + 启动) +set -e +cd "$(dirname "$0")/.." +echo "🚀 开始一键部署..." +echo "" +echo "🔨 步骤 1/2: 构建镜像..." +docker compose build --no-cache +echo "" +echo "🚀 步骤 2/2: 启动服务..." +docker compose up -d +echo "" +echo "✅ 部署完成!" +echo "📍 访问地址: http://localhost:${PORT:-3000}" +echo "📋 查看日志: ./scripts/logs.sh" diff --git a/frontend/admin-web/scripts/health.sh b/frontend/admin-web/scripts/health.sh new file mode 100644 index 00000000..cf011376 --- /dev/null +++ b/frontend/admin-web/scripts/health.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# 健康检查 +cd "$(dirname "$0")/.." +echo "🏥 健康检查..." +response=$(curl -s http://localhost:${PORT:-3000}/api/health) +if [ $? -eq 0 ]; then + echo "✅ 服务健康" + echo "$response" | python3 -m json.tool 2>/dev/null || echo "$response" +else + echo "❌ 服务不可用" + exit 1 +fi diff --git a/frontend/admin-web/scripts/logs.sh b/frontend/admin-web/scripts/logs.sh new file mode 100644 index 00000000..4ff1383a --- /dev/null +++ b/frontend/admin-web/scripts/logs.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# 查看实时日志 +cd "$(dirname "$0")/.." +echo "📋 查看日志 (Ctrl+C 退出)..." +docker compose logs -f diff --git a/frontend/admin-web/scripts/restart.sh b/frontend/admin-web/scripts/restart.sh new file mode 100644 index 00000000..3e8b0558 --- /dev/null +++ b/frontend/admin-web/scripts/restart.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# 重启服务 +set -e +cd "$(dirname "$0")/.." +echo "🔄 重启服务..." +docker compose restart +echo "✅ 服务已重启" diff --git a/frontend/admin-web/scripts/start.sh b/frontend/admin-web/scripts/start.sh new file mode 100644 index 00000000..c585d79d --- /dev/null +++ b/frontend/admin-web/scripts/start.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# 启动服务 +set -e +cd "$(dirname "$0")/.." +echo "🚀 启动服务..." +docker compose up -d +echo "✅ 服务已启动" +echo "📍 访问地址: http://localhost:${PORT:-3000}" diff --git a/frontend/admin-web/scripts/status.sh b/frontend/admin-web/scripts/status.sh new file mode 100644 index 00000000..a36f8e36 --- /dev/null +++ b/frontend/admin-web/scripts/status.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# 查看服务状态 +cd "$(dirname "$0")/.." +echo "📊 服务状态:" +docker compose ps diff --git a/frontend/admin-web/scripts/stop.sh b/frontend/admin-web/scripts/stop.sh new file mode 100644 index 00000000..d10c1981 --- /dev/null +++ b/frontend/admin-web/scripts/stop.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# 停止服务 +set -e +cd "$(dirname "$0")/.." +echo "🛑 停止服务..." +docker compose down +echo "✅ 服务已停止"