Files
shveitechbot/docker-compose.yml

60 lines
1.5 KiB
YAML

services:
postgres:
env_file: .env
image: postgres:16-alpine
container_name: shveitech_postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-postgres}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-postgres}",
]
interval: 10s
timeout: 5s
retries: 5
ports:
- "5432:5432"
redis:
image: redis:7-alpine
container_name: shveitech_redis
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
ports:
- "6379:6379"
bot:
env_file: .env
build:
dockerfile: Dockerfile
container_name: shveitech_bot
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
BOT_TOKEN: ${BOT_TOKEN}
ADMINS: ${ADMINS}
POSTGRES_URL: postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-postgres}
CARD_NUMBER: ${CARD_NUMBER}
CARD_HOLDER: ${CARD_HOLDER}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
PROXY_URL: ${PROXY_URL}
command: ["sh", "-c", "alembic upgrade head && python main.py"]
restart: unless-stopped
volumes:
- ./images:/app/images
volumes:
postgres_data: