重构 seed 为 WC2026 72 场小组赛与 48 强优胜盘;新增 production 模式仅保留 admin 与赛事示例;提供 prod-init-db 全量重置脚本;管理端 i18n 分包与赛事归档能力。 Co-authored-by: Cursor <cursoragent@cursor.com>
98 lines
2.1 KiB
YAML
98 lines
2.1 KiB
YAML
# TheBet365 全栈生产部署
|
||
# 一键启动: docker compose -f docker-compose.prod.yml up -d --build
|
||
# 首次部署建议 SEED_DATABASE=true(见 .env.docker)
|
||
|
||
services:
|
||
postgres:
|
||
image: postgres:16-alpine
|
||
container_name: thebet365-postgres
|
||
environment:
|
||
POSTGRES_USER: thebet365
|
||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-thebet365}
|
||
POSTGRES_DB: thebet365
|
||
volumes:
|
||
- postgres_data:/var/lib/postgresql/data
|
||
healthcheck:
|
||
test: ['CMD-SHELL', 'pg_isready -U thebet365']
|
||
interval: 5s
|
||
timeout: 5s
|
||
retries: 10
|
||
restart: unless-stopped
|
||
networks:
|
||
- thebet365
|
||
|
||
redis:
|
||
image: redis:7-alpine
|
||
container_name: thebet365-redis
|
||
volumes:
|
||
- redis_data:/data
|
||
healthcheck:
|
||
test: ['CMD', 'redis-cli', 'ping']
|
||
interval: 5s
|
||
timeout: 5s
|
||
retries: 5
|
||
restart: unless-stopped
|
||
networks:
|
||
- thebet365
|
||
|
||
api:
|
||
build:
|
||
context: .
|
||
dockerfile: docker/api/Dockerfile
|
||
container_name: thebet365-api
|
||
env_file:
|
||
- .env.docker
|
||
environment:
|
||
DATABASE_URL: postgresql://thebet365:${POSTGRES_PASSWORD:-thebet365}@postgres:5432/thebet365
|
||
REDIS_URL: redis://redis:6379
|
||
PORT: 3000
|
||
NODE_ENV: production
|
||
UPLOAD_DIR: /app/uploads
|
||
volumes:
|
||
- uploads_data:/app/uploads
|
||
depends_on:
|
||
postgres:
|
||
condition: service_healthy
|
||
redis:
|
||
condition: service_healthy
|
||
ports:
|
||
- '${API_PORT:-3000}:3000'
|
||
restart: unless-stopped
|
||
networks:
|
||
- thebet365
|
||
|
||
player:
|
||
build:
|
||
context: .
|
||
dockerfile: docker/player/Dockerfile
|
||
container_name: thebet365-player
|
||
depends_on:
|
||
- api
|
||
ports:
|
||
- '${PLAYER_PORT:-8082}:80'
|
||
restart: unless-stopped
|
||
networks:
|
||
- thebet365
|
||
|
||
admin:
|
||
build:
|
||
context: .
|
||
dockerfile: docker/admin/Dockerfile
|
||
container_name: thebet365-admin
|
||
depends_on:
|
||
- api
|
||
ports:
|
||
- '${ADMIN_PORT:-8081}:80'
|
||
restart: unless-stopped
|
||
networks:
|
||
- thebet365
|
||
|
||
networks:
|
||
thebet365:
|
||
name: thebet365
|
||
|
||
volumes:
|
||
postgres_data:
|
||
redis_data:
|
||
uploads_data:
|