Files
new_lottery_bot/docker-compose.yml
Trevor1985 cb35bb12e3
Some checks failed
continuous-integration/drone/push Build is failing
Stabilize staff concurrency and premium emoji; enable verified Drone deployment
2026-09-13 19:48:41 +09:00

59 lines
1.5 KiB
YAML

services:
# Enable COMPOSE_PROFILES=local-db only when PostgreSQL is hosted in this stack.
postgres:
profiles: [local-db]
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-lottery_bot}
POSTGRES_USER: ${POSTGRES_USER:-lottery_bot}
# PostgreSQL itself rejects an empty password when local-db is enabled.
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: [CMD-SHELL, 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"']
interval: 5s
timeout: 5s
retries: 20
redis:
image: redis:7-alpine
container_name: lottery_redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
healthcheck:
test: [CMD, redis-cli, ping]
interval: 5s
timeout: 5s
retries: 20
bot:
image: ${BOT_IMAGE:-new_lottery_bot:local}
build: .
container_name: lottery_bot
restart: unless-stopped
init: true
env_file: .env.prod
environment:
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
volumes:
- bot_data:/app/data
depends_on:
redis:
condition: service_healthy
stop_grace_period: 45s
healthcheck:
test: [CMD, python, -m, src.core.health]
interval: 15s
timeout: 5s
retries: 4
start_period: 30s
volumes:
bot_data:
postgres_data:
redis_data: