docker-compose.yml•2.08 kB
services:
  scraper-mcp:
    build:
      context: .
      dockerfile: Dockerfile
      # Pass proxy settings at build time (for package installation)
      args:
        - HTTP_PROXY=${HTTP_PROXY:-}
        - HTTPS_PROXY=${HTTPS_PROXY:-}
        - NO_PROXY=${NO_PROXY:-}
        - http_proxy=${http_proxy:-}
        - https_proxy=${https_proxy:-}
        - no_proxy=${no_proxy:-}
    container_name: scraper-mcp
    ports:
      - "8000:8000"
    environment:
      # Set transport type (streamable-http or sse)
      - TRANSPORT=streamable-http
      # Set host and port
      - HOST=0.0.0.0
      - PORT=8000
      # Set cache directory
      - CACHE_DIR=/app/cache
      # Proxy settings for runtime requests (standard environment variables)
      - HTTP_PROXY=${HTTP_PROXY:-}
      - HTTPS_PROXY=${HTTPS_PROXY:-}
      - NO_PROXY=${NO_PROXY:-}
      - http_proxy=${http_proxy:-}
      - https_proxy=${https_proxy:-}
      - no_proxy=${no_proxy:-}
      # ScrapeOps proxy configuration (optional, enabled if API key provided)
      - SCRAPEOPS_API_KEY=${SCRAPEOPS_API_KEY:-}
      - SCRAPEOPS_RENDER_JS=${SCRAPEOPS_RENDER_JS:-false}
      - SCRAPEOPS_RESIDENTIAL=${SCRAPEOPS_RESIDENTIAL:-false}
      - SCRAPEOPS_COUNTRY=${SCRAPEOPS_COUNTRY:-}
      - SCRAPEOPS_KEEP_HEADERS=${SCRAPEOPS_KEEP_HEADERS:-false}
      - SCRAPEOPS_DEVICE=${SCRAPEOPS_DEVICE:-desktop}
    volumes:
      # Persistent cache volume (~1GB target)
      - cache_data:/app/cache
    restart: unless-stopped
    # Memory limit: 1.5GB (1GB for cache + 0.5GB overhead)
    deploy:
      resources:
        limits:
          memory: 1536M
        reservations:
          memory: 512M
    healthcheck:
      test: ["CMD", "python", "-c", "import requests; r = requests.get('http://localhost:8000/healthz', timeout=5); exit(0 if r.status_code == 200 else 1)"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    networks:
      - mcp-network
volumes:
  # Named volume for persistent cache storage
  cache_data:
    driver: local
networks:
  mcp-network:
    driver: bridge