services: api: build: . ports: - "127.0.0.1:${APP_PORT}:8080" environment: - APP_HOST=${APP_HOST} - APP_PORT=${APP_PORT} - DATABASE_URL=${DATABASE_URL} - SESSION_TTL_SECONDS=${SESSION_TTL_SECONDS} - REDIS_URL=${REDIS_URL} depends_on: postgres: condition: service_healthy redis: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"] interval: 10s timeout: 3s start_period: 15s retries: 3 postgres: image: postgres:16.3-alpine environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB} volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 3s start_period: 10s retries: 5 restart: unless-stopped redis: image: redis:8.10-alpine command: redis-server --appendonly yes --save 60 1 volumes: - redisdata:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s start_period: 5s retries: 5 restart: unless-stopped volumes: pgdata: redisdata: