services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_DB: proxy
      POSTGRES_USER: proxy
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-devpass}
    ports:
      - "${POSTGRES_PORT:-5432}:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U proxy"]
      interval: 2s
      timeout: 5s
      retries: 10

  gateway:
    image: ghcr.io/antkawam/claude-code-aws-gateway:${CCAG_VERSION:-latest}
    depends_on:
      postgres:
        condition: service_healthy
    ports:
      - "${GATEWAY_PORT:-8080}:8080"
    environment:
      DATABASE_URL: postgres://proxy:${POSTGRES_PASSWORD:-devpass}@postgres:5432/proxy
      PROXY_HOST: "0.0.0.0"
      ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin}
      RUST_LOG: ${RUST_LOG:-info}
      AWS_REGION: ${AWS_REGION:-us-east-1}
      AWS_PROFILE: ${AWS_PROFILE:-}
      AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-}
      AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-}
      AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN:-}
      OIDC_ISSUER: ${OIDC_ISSUER:-}
      OIDC_AUDIENCE: ${OIDC_AUDIENCE:-}
    volumes:
      - ${HOME}/.aws:/home/proxy/.aws:ro

volumes:
  pgdata:
