name: gavrilenko-lab2 services: db: image: postgres:17.6-alpine3.22 environment: POSTGRES_USER: messenger POSTGRES_DB: messenger POSTGRES_PASSWORD_FILE: /run/secrets/db_password secrets: - db_password volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U messenger -d messenger"] interval: 2s timeout: 3s retries: 30 restart: unless-stopped api: build: . environment: APP_HOST: 0.0.0.0 APP_PORT: 8080 DATABASE_URL_FILE: /run/secrets/database_url SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} secrets: - database_url ports: - "127.0.0.1:${HOST_PORT:-8082}:8080" depends_on: db: condition: service_healthy healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready', timeout=3)"] interval: 2s timeout: 4s retries: 30 restart: unless-stopped secrets: db_password: file: ./secrets/db_password database_url: file: ./secrets/database_url volumes: postgres_data: