Files
2026-10-26 14:27:25 +03:00

49 lines
1.1 KiB
YAML

version: '3.8'
services:
api:
build: .
ports:
- "8080:8080"
environment:
- DATABASE_URL=postgresql+asyncpg://mtusi:mtusi_password@postgres:5432/messenger_db
- REDIS_URL=redis://redis:6379/0
- SESSION_TTL_SECONDS=3600
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_USER=mtusi
- POSTGRES_PASSWORD=mtusi_password
- POSTGRES_DB=messenger_db
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mtusi -d messenger_db"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redisdata:/data
command: ["redis-server", "--appendonly", "yes"] # Важно для сохранения сессий при рестарте
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
volumes:
pgdata:
redisdata: