refactor: 彻底移除 docker compose,改用纯 docker 构建+重启部署
Build and Deploy / build (push) Successful in 12s
Build and Deploy / deploy (push) Successful in 26s

This commit is contained in:
cheney
2026-09-01 10:27:11 +08:00
parent e11814048c
commit a5c5d24083
7 changed files with 53 additions and 83 deletions
+7 -12
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# Awesome Index 部署脚本(直接部署,不使用 Docker)
# Awesome Index 部署脚本(构建机 = 部署机:本地构建镜像,SSH 重启容器)
# 服务器: 114.134.187.170
set -e
@@ -19,20 +19,15 @@ if ! command -v sshpass &> /dev/null; then
exit 1
fi
echo "1. 创建部署目录..."
sshpass -p "$REMOTE_PASS" ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" \
"mkdir -p $DEPLOY_PATH/data $DEPLOY_PATH/logs"
echo "1. 构建 Docker 镜像..."
docker build -t awesome-index:latest .
echo "2. 上传源码..."
sshpass -p "$REMOTE_PASS" scp -o StrictHostKeyChecking=no -r \
package.json package-lock.json src public .env.example start.sh \
echo "2. 上传脚本到服务器..."
sshpass -p "$REMOTE_PASS" scp -o StrictHostKeyChecking=no \
start.sh .env.example \
"$REMOTE_USER@$REMOTE_HOST:$DEPLOY_PATH/"
echo "3. 重命名 .env.example 为 .env(如不存在)..."
sshpass -p "$REMOTE_PASS" ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" \
"cd $DEPLOY_PATH && [ ! -f .env ] && cp .env.example .env"
echo "4. 在服务器上执行启动脚本..."
echo "3. 在服务器上重启容器..."
sshpass -p "$REMOTE_PASS" ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" \
"cd $DEPLOY_PATH && chmod +x start.sh && bash start.sh"