services:
  gateway:
    build:
      context: ../metalcraft-agent-gateway
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    environment:
      PORT: "3000"
      AGENT_GATEWAY_API_KEY: ${AGENT_GATEWAY_API_KEY}
      DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN}
      SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN:-}
      SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET:-}
      GITHUB_WEBHOOK_SECRET: ${GITHUB_WEBHOOK_SECRET:-}
      GATEWAY_DB_PATH: /data/gateway.db
      RUST_LOG: info
    volumes:
      - gateway-data:/data
    restart: unless-stopped

  daemon:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "3001:3001"
    environment:
      OPENAI_API_KEY: ${OPENAI_API_KEY}
      AGENT_GATEWAY_URL: http://gateway:3000
      AGENT_GATEWAY_API_KEY: ${AGENT_GATEWAY_API_KEY}
      EVENTD_HOST: daemon
      EVENTD_PORT: "3001"
      EVENTD_WEBHOOK_SECRET: ${EVENTD_WEBHOOK_SECRET}
      EVENTD_ADMIN_USER_IDS: ${EVENTD_ADMIN_USER_IDS}
      METALCRAFT_DATA_DIR: /data
      RUST_LOG: info
    command:
      - metalcraft-daemon
      - --persona
      - discord-agent
      - --auto-approve
      - --event-port
      - "3001"
      - --events
      - message_create
      - --platforms
      - discord
    volumes:
      - daemon-data:/data
    depends_on:
      - gateway
    restart: unless-stopped

volumes:
  gateway-data:
  daemon-data:
