# Docker Compose for Local Bot Testing
# This runs the bot in a container using the same Dockerfile as Railway

services:
  screenshare-bot-test:
    build:
      context: ../../
      dockerfile: Dockerfile
      # Use same build args as Railway if needed
    container_name: screenshare-bot-local
    environment:
      # Transport configuration
      - TRANSPORT_TYPE=livekit

      # LiveKit credentials (load from .env.local)
      - LIVEKIT_URL=${LIVEKIT_URL}
      - LIVEKIT_API_KEY=${LIVEKIT_API_KEY}
      - LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET}
      - LIVEKIT_ROOM_NAME=${LIVEKIT_ROOM_NAME:-test-room-local}

      # Supabase credentials
      - SUPABASE_URL=${SUPABASE_URL}
      - SUPABASE_SERVICE_KEY=${SUPABASE_SERVICE_KEY}

      # Python configuration
      - PYTHONUNBUFFERED=1

    # Mount the bot code (optional, for live code updates during development)
    volumes:
      - ./:/app/bots/screenshare-bot:ro
      - ./test_logs:/app/bots/screenshare-bot/test_logs
      - ./test_screenshots:/app/bots/screenshare-bot/test_screenshots

    # Working directory (same as Railway)
    working_dir: /app/bots/screenshare-bot

    # Command will be specified via helper script or CLI override
    # Default: run the test script
    command: /app/.venv/bin/python test_local_capture.py

    # Network mode (bridge is default, but can be changed)
    network_mode: bridge

    # Security options (for Playwright/Chromium)
    security_opt:
      - seccomp:unconfined

    # Shared memory size (needed for Chromium)
    shm_size: 2gb
