services: api: build: . ports: - "8080:8080" environment: - DATABASE_URL=postgresql://postgres:postgres@postgres:5432/messenger - SESSION_TTL_SECONDS=3600 depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"] interval: 10s timeout: 5s retries: 5 postgres: image: postgres:15-alpine environment: - POSTGRES_DB=messenger - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres volumes: - postgres_data:/var/lib/postgresql/data - ./migrations/001_initial.sql:/docker-entrypoint-initdb.d/001_initial.sql healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 3s retries: 5 volumes: postgres_data: