Spaces:
Paused
Paused
File size: 1,795 Bytes
dd6c2d5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | version: '3.8'
services:
# Discord Bot
bot:
build: .
container_name: discord_bot
restart: unless-stopped
environment:
- BOT_TOKEN=${BOT_TOKEN}
- OWNER_ID=${OWNER_ID:-0}
- DB_HOST=db
- DB_PORT=5432
- DB_USER=${DB_USER:-discord_bot}
- DB_PASS=${DB_PASS:-change_me_strong_password}
- DB_NAME=${DB_NAME:-fan_bot}
- REDIS_HOST=redis
- REDIS_PORT=6379
- LOG_LEVEL=${LOG_LEVEL:-INFO}
volumes:
- ./transcripts:/app/transcripts
- ./logs:/app/logs
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
networks:
- bot_network
# PostgreSQL 数据库
db:
image: postgres:15-alpine
container_name: discord_bot_db
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-discord_bot}
POSTGRES_PASSWORD: ${DB_PASS:-change_me_strong_password}
POSTGRES_DB: ${DB_NAME:-fan_bot}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${DB_EXTERNAL_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-discord_bot} -d ${DB_NAME:-fan_bot}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- bot_network
# Redis 缓存
redis:
image: redis:7-alpine
container_name: discord_bot_redis
restart: unless-stopped
volumes:
- redis_data:/data
ports:
- "${REDIS_EXTERNAL_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- bot_network
volumes:
postgres_data:
redis_data:
networks:
bot_network:
driver: bridge
|