services:
  cursor-api-proxy:
    build:
      context: .
      dockerfile: Dockerfile
    image: cursor-api-proxy:latest
    container_name: cursor-api-proxy
    restart: unless-stopped
    env_file:
      - .env
    ports:
      - "${CURSOR_BRIDGE_PORT:-8766}:${CURSOR_BRIDGE_PORT:-8766}"
    environment:
      - CURSOR_BRIDGE_HOST=0.0.0.0
    volumes:
      # Cursor CLI 二進位檔（從宿主機掛載，唯讀）
      - ${CURSOR_AGENT_HOST_BIN:-/usr/local/bin/agent}:/usr/local/bin/agent:ro
      # 帳號設定目錄（持久化帳號資料）
      - ${CURSOR_ACCOUNTS_DIR:-~/.cursor-api-proxy}:/root/.cursor-api-proxy
      # 工作區（選用，掛載你想讓 agent 存取的專案目錄）
      - ${WORKSPACE_DIR:-/tmp/workspace}:/workspace
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:${CURSOR_BRIDGE_PORT:-8766}/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s
