x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: 100m
      max-file: '3'

services:
  portkey-gateway:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}portkeyai/gateway:${PORTKEY_GATEWAY_VERSION:-latest}
    ports:
      - '${PORTKEY_GATEWAY_PORT_OVERRIDE:-8787}:8787'
    environment:
      - TZ=${TZ:-UTC}
    healthcheck:
      test: [CMD, wget, --spider, -q, 'http://localhost:8787']
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    deploy:
      resources:
        limits:
          cpus: ${PORTKEY_GATEWAY_CPU_LIMIT:-1.0}
          memory: ${PORTKEY_GATEWAY_MEMORY_LIMIT:-512M}
        reservations:
          cpus: ${PORTKEY_GATEWAY_CPU_RESERVATION:-0.1}
          memory: ${PORTKEY_GATEWAY_MEMORY_RESERVATION:-128M}
