services: api: build: . ports: - "127.0.0.1:8080:8080" environment: - APP_HOST=0.0.0.0 - APP_PORT=8080 - SESSION_TTL_SECONDS=3600 - DATABASE_URL=postgresql+asyncpg://user:password@db:5432/messenger - SESSION_STORE=redis - CACHE_URL=redis://redis:6379/0 depends_on: db: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/live')"] interval: 5s timeout: 3s retries: 5 db: image: postgres:16-alpine environment: - POSTGRES_USER=user - POSTGRES_PASSWORD=password - POSTGRES_DB=messenger volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U user -d messenger"] interval: 3s timeout: 3s retries: 5 redis: image: redis:7-alpine command: redis-server --appendonly yes volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 3s timeout: 3s retries: 5 volumes: pgdata: redisdata: