101 lines
2.3 KiB
YAML
101 lines
2.3 KiB
YAML
version: '3.9'
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: finance_bot_postgres
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-finance_user}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_DB: ${DB_NAME:-finance_db}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-finance_user}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- finance_network
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: finance_bot_redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- finance_network
|
|
|
|
migrations:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: finance_bot_migrations
|
|
command: alembic upgrade head
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg2://${DB_USER:-finance_user}:${DB_PASSWORD}@postgres:5432/${DB_NAME:-finance_db}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- finance_network
|
|
|
|
bot:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: finance_bot_bot
|
|
command: python -m app.main
|
|
environment:
|
|
BOT_TOKEN: ${BOT_TOKEN}
|
|
DATABASE_URL: postgresql+psycopg2://finance_user:finance_pass@postgres:5432/finance_db
|
|
REDIS_URL: redis://redis:6379/0
|
|
APP_ENV: production
|
|
LOG_LEVEL: INFO
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- finance_network
|
|
restart: unless-stopped
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: finance_bot_web
|
|
command: uvicorn app.api.main:app --host 0.0.0.0 --port 8000
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg2://finance_user:finance_pass@postgres:5432/finance_db
|
|
REDIS_URL: redis://redis:6379/0
|
|
APP_ENV: production
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- finance_network
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
finance_network:
|
|
driver: bridge
|