services:
  mercari-scraper:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: mercari_scraper
    restart: unless-stopped
    volumes:
      - ${MERCARI_SCRIPT_PATH}:/app/mercari_server.py:ro
    ports:
      - "${MERCARI_PORT:-5100}:5100"   # 検索API
      - "${NOVNC_PORT:-6080}:6080"     # noVNC (ブラウザで Firefox 画面を確認)
    environment:
      - MERCARI_PORT=5100
      - NOVNC_PORT=6080
      - SCREEN_WIDTH=1920
      - SCREEN_HEIGHT=1080
    # DS220+ (2GB RAM) ではメモリ制限を適宜調整
    deploy:
      resources:
        limits:
          memory: 1536M
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5100/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
