# zonos-gateway — deploys on irv-ml1 next to the Zonos server.
# Follows the fleet convention: /opt/docker/compose/zonos-gateway/compose.yaml,
# tunables in an adjacent .env (this file stays constant).
services:
  zonos-gateway:
    build: .
    image: zonos-gateway:0.2.0
    container_name: zonos-gateway
    restart: unless-stopped
    # Colocated with Zonos: reach the host's :1920 from inside the container.
    # host-gateway resolves host.docker.internal to the host's bridge IP.
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      # Default targets the Zonos server on the same host. For a non-colocated
      # or dev target, override in .env (e.g. ZONOS_URL=http://10.100.79.3:1920).
      ZONOS_URL: ${ZONOS_URL:-http://host.docker.internal:1920}
      PORT: ${PORT:-8890}
      DEFAULT_VOICE: ${DEFAULT_VOICE:-Cora}
      VOICES_DIR: /app/voices
      REQUEST_TIMEOUT_S: ${REQUEST_TIMEOUT_S:-600}
    volumes:
      # Host-managed voices (2026-07-17): drop <Name>.wav in ./voices + restart
      # -> selectable as voice:"Name", no image rebuild (matches the registry's
      # filesystem-drop-in design). Emmie added this way.
      - ./voices:/app/voices:ro
    ports:
      - "${PORT:-8890}:8890"
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8890/health', timeout=5).status==200 else 1)"]
      interval: 30s
      timeout: 8s
      retries: 3
      start_period: 15s
