services:
  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_DB: payments
      POSTGRES_USER: payments
      POSTGRES_PASSWORD: ${DEV_DB_PASSWORD:-local-development-only}
    ports:
      - "127.0.0.1:5432:5432"
    volumes:
      - payments-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U payments -d payments"]
      interval: 3s
      timeout: 3s
      retries: 20
    command: ["postgres", "-c", "statement_timeout=5000", "-c", "lock_timeout=2000", "-c", "idle_in_transaction_session_timeout=10000"]
volumes:
  payments-data:
