Files
new_lottery_bot/docker-compose.yml
Trevor1985 8094cbb8f7
All checks were successful
continuous-integration/drone/push Build is passing
Preserve the production network and normalize runtime image permissions
2026-09-13 19:58:19 +09:00

66 lines
1.6 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
networks: [lottery_network]
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
networks: [lottery_network]
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
networks: [lottery_network]
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:
networks:
lottery_network:
driver: bridge