version: '3.8'

services:
  iptv-web:
    build: .
    container_name: iptv-web
    ports:
      - "3000:3000"
    environment:
      - PORT=3000
      - NODE_ENV=production
    volumes:
      # 挂载频道数据（可选，用于更新）
      - ../ui/dist-web/api:/app/public/api:ro
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  # 可选：使用 Nginx 作为反向代理
  nginx:
    image: nginx:alpine
    container_name: iptv-nginx
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./nginx/ssl:/etc/nginx/ssl:ro
    depends_on:
      - iptv-web
    restart: unless-stopped
    profiles:
      - nginx
