awesome/deploy.sh
cheney a5c5d24083
All checks were successful
Build and Deploy / build (push) Successful in 12s
Build and Deploy / deploy (push) Successful in 26s
refactor: 彻底移除 docker compose,改用纯 docker 构建+重启部署
2026-09-01 10:27:11 +08:00

36 lines
1.0 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Awesome Index 部署脚本(构建机 = 部署机本地构建镜像SSH 重启容器)
# 服务器: 114.134.187.170
set -e
REMOTE_HOST="114.134.187.170"
REMOTE_USER="root"
REMOTE_PASS="2VAJgRs8l99Z"
DEPLOY_PATH="/app/awesome"
echo "=== 部署 Awesome Index 到 baihu 服务器 ==="
# 使用 sshpass 安装依赖(如果没有)
if ! command -v sshpass &> /dev/null; then
echo "请先安装 sshpass:"
echo " Ubuntu/Debian: sudo apt-get install sshpass"
echo " macOS: brew install hudochenkov/sshpass/sshpass"
exit 1
fi
echo "1. 构建 Docker 镜像..."
docker build -t awesome-index:latest .
echo "2. 上传脚本到服务器..."
sshpass -p "$REMOTE_PASS" scp -o StrictHostKeyChecking=no \
start.sh .env.example \
"$REMOTE_USER@$REMOTE_HOST:$DEPLOY_PATH/"
echo "3. 在服务器上重启容器..."
sshpass -p "$REMOTE_PASS" ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_HOST" \
"cd $DEPLOY_PATH && chmod +x start.sh && bash start.sh"
echo ""
echo "=== 部署完成 ==="