services:
  iroh-server:
    build:
      context: ../..
      dockerfile: server/Dockerfile
    entrypoint: ["node", "--import", "tsx", "e2e/iroh-isolated-server.ts"]
    environment:
      OPPI_DATA_DIR: /data/oppi
      PI_CODING_AGENT_DIR: /data/pi-agent
      PI_AGENT_SYNC_MODE: skip
      OPPI_IROH_TRANSPORT: "1"
      OPPI_IROH_INVITE_MODE: irohOnly
      OPPI_BONJOUR: "0"
      OPPI_LOG_LEVEL: debug
    volumes:
      - iroh-exchange:/exchange
      - iroh-server-data:/data/oppi
      - iroh-server-agent:/data/pi-agent
    networks:
      iroh-link:
      server-egress:
    healthcheck:
      test: ["CMD-SHELL", "test -s /exchange/invite.json"]
      interval: 1s
      timeout: 2s
      retries: 90
      start_period: 5s

  iroh-client:
    build:
      context: ../..
      dockerfile: server/Dockerfile
    entrypoint: ["node", "--import", "tsx", "e2e/iroh-isolated-client.ts"]
    depends_on:
      iroh-server:
        condition: service_healthy
    volumes:
      - iroh-exchange:/exchange:ro
    networks:
      iroh-link:
      client-egress:

networks:
  iroh-link:
    internal: true
  server-egress:
  client-egress:

volumes:
  iroh-exchange:
  iroh-server-data:
  iroh-server-agent:
