version: '3.8'

services:
  nexstream-scraper:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: nexstream-scraper
    # Ports removed — exposed via Tailscale Funnel through nginx only
    # Direct 0.0.0.0 exposure was attracting bot traffic
    volumes:
      # Persist SQLite cache across restarts
      - scraper-data:/app/src/data
    env_file:
      - .env
    environment:
      - NODE_ENV=production
      - PORT=3091
      - SCRAPER_PUBLIC_IP=192.168.1.50
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3091/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s
    networks:
      - nexstream-net

volumes:
  scraper-data:
    name: nexstream-scraper-data

networks:
  nexstream-net:
    name: nexstream-net
    driver: bridge
