# OpenHands - AI Software Development Agent
# Port: 3001
# Docs: https://docs.openhands.dev
# LLM: Claude Sonnet 4

version: '3.8'

services:
  openhands:
    image: docker.openhands.dev/openhands/openhands:1.1
    container_name: openhands-app
    ports:
      - "3001:3000"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      # LLM Configuration
      - LLM_API_KEY=${ANTHROPIC_API_KEY}
      - LLM_MODEL=anthropic/claude-sonnet-4-20250514
      # Sandbox Configuration
      - SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.openhands.dev/openhands/runtime:1.1-nikolaik
      - LOG_ALL_EVENTS=true
      - RUN_AS_OPENHANDS=true
      - OPENHANDS_USER_ID=42420
      # Use docker bridge gateway IP so runtime containers can reach the main container
      - SANDBOX_LOCAL_RUNTIME_URL=http://172.17.0.1
      - USE_HOST_NETWORK=false
      - WORKSPACE_BASE=/opt/workspace_base
      - SANDBOX_USER_ID=0
      - FILE_STORE=local
      - FILE_STORE_PATH=/.openhands
      - INIT_GIT_IN_EMPTY_WORKSPACE=1
      # Disable default MCP (runtime can't resolve host.docker.internal)
      - DISABLE_DEFAULT_MCP=true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - openhands-data:/.openhands
    restart: unless-stopped

volumes:
  openhands-data:
