This commit is contained in:
wchino
2026-06-13 17:38:25 +08:00
parent e7e938f261
commit 7b33d9f9fa
190 changed files with 23222 additions and 4336 deletions

View File

@@ -59,7 +59,9 @@ Write-Host "完成: $OutputPath (${sizeMb} MB)"
Write-Host @"
:
docker load -i thebet365-images.tar
docker compose -f docker-compose.prod.yml --env-file .env.docker up -d
:
./scripts/deploy-first.sh --images thebet365-images.tar
:
./scripts/deploy-update.sh --images thebet365-images.tar
"@

View File

@@ -89,7 +89,9 @@ fi
cat <<'EOF'
服务器加载:
docker load -i thebet365-images.tar
docker compose -f docker-compose.prod.yml --env-file .env.docker up -d
服务器首次部署:
./scripts/deploy-first.sh --images thebet365-images.tar
服务器后续更新:
./scripts/deploy-update.sh --images thebet365-images.tar
EOF

View File

@@ -31,7 +31,7 @@
- `POSTGRES_PASSWORD``JWT_SECRET`
- `CHUANGLAN_ACCOUNT``CHUANGLAN_PASSWORD`(短信注册)
- `SEED_DATABASE`(首次 `true`,灌完数据后改 `false`
- `SEED_DATABASE=false`(生产建议保持 false由部署脚本按需一次性 seed
---
@@ -93,7 +93,7 @@ chmod +x docs/docker/build-and-export-images.sh
---
## 五、上传到服务器并加载
## 五、上传到服务器并部署
### 1. 上传
@@ -106,28 +106,23 @@ chmod +x docs/docker/build-and-export-images.sh
可用 SCP、宝塔文件管理、rsync 等。
### 2. 加载镜像
### 2. 首次部署
```bash
cd /www/wwwroot/thebet365
docker load -i thebet365-images.tar
chmod +x scripts/*.sh
./scripts/deploy-first.sh --images thebet365-images.tar
```
确认镜像
后续更新同一个服务器时
```bash
docker images | grep thebet365
./scripts/deploy-update.sh --images thebet365-images.tar
```
### 3. 启动服务
更新脚本会先备份数据库,再用新 API 镜像执行 `prisma migrate deploy`,最后替换运行中的容器。
```bash
docker compose -f docker-compose.prod.yml --env-file .env.docker up -d
```
API 容器启动时会自动执行 `prisma migrate deploy`,一般无需手动迁移。
### 4. 验证
### 3. 验证
```bash
docker compose -f docker-compose.prod.yml ps
@@ -148,7 +143,7 @@ docker logs thebet365-api --tail 50
| **本地 build + 导出 tar** | 不占用服务器 CPU/内存;可重复部署同一包 | 需上传较大 tar约 200300 MB |
| **服务器 `docker compose build`** | 无需传 tar | 首次/全量构建慢,小内存机器易失败 |
发版推荐流程:**本地或构建机执行脚本 → 上传 tar → 服务器 `docker load``up -d`**。
发版推荐流程:**本地或构建机执行脚本 → 上传 tar → 服务器执行 `deploy-update.sh --images thebet365-images.tar`**。
---