Files
user-system/scripts/ops/install_docker.sh
long-agent 5b6bd93179 refactor: 整理项目根目录结构
整理内容:
- 删除 60+ 临时测试输出文件 (*.txt)
- 移动二进制文件到 bin/ 目录
- 移动 Shell 脚本到 scripts/ 目录
  - scripts/dev/: check_gitea.sh, check_sub2api.sh, run_tests.sh
  - scripts/deploy/: deploy_*.sh, simple_deploy.sh
  - scripts/ops/: fix_nginx.sh, fix_ssl.sh, install_docker.sh
  - scripts/test/: test_*.sh, test_*.bat
- 移动批处理文件到 scripts/
- 移动 Python 脚本到 tools/
- 清理临时日志文件

保留根目录必要文件:
- go.mod, go.sum, go.work
- Makefile, docker-compose.yml
- .env.example, .gitignore
- README.md, AGENTS.md, DEPLOY_GUIDE.md

验证: go build ./... && go test ./... 通过
2026-04-07 18:10:36 +08:00

52 lines
1.3 KiB
Bash

#!/bin/bash
# Docker 和服务部署脚本
echo "[1/4] 安装 Docker..."
curl -fsSL https://get.docker.com | sh
systemctl enable docker
systemctl start docker
echo "[2/4] 验证 Docker..."
docker --version
echo "[3/4] 部署 Gitea..."
mkdir -p /opt/gitea
cd /opt/gitea
cat > docker-compose.yml << 'EOF'
version: "3.8"
services:
gitea:
image: gitea/gitea:latest
container_name: gitea
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"
- "127.0.0.1:2222:22"
volumes:
- gitea-data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__database__DB_TYPE=sqlite3
- GITEA__server__DOMAIN=tksea.top
- GITEA__server__ROOT_URL=https://tksea.top/
volumes:
gitea-data:
EOF
docker compose up -d
echo "[4/4] 部署 Sub2API..."
mkdir -p /opt/sub2api/deploy
cd /opt/sub2api/deploy
curl -sSL https://raw.githubusercontent.com/Wei-Shaw/sub2api/main/deploy/docker-deploy.sh | bash
echo ""
echo "========================================"
echo "部署完成!"
echo "========================================"
echo "检查状态: docker ps"
echo "访问: https://tksea.top (Gitea)"
echo "访问: https://api.tksea.top (Sub2API)"
echo "========================================"