version: '3.8'

services:
  stream-capture:
    build: .
    container_name: srt-stream-capture
    environment:
      - SRT_URL=srt://176.175.231.16:8516?passphrase=BDEKCYAcDsCjebYbRjfv
      - SEGMENT_TIME=5
      - MAX_SEGMENTS=1000  # Keep last 1000 segments
      - RETRY_DELAY=5      # Seconds to wait before retry on failure
    volumes:
      - ./segments:/app/segments
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "bash", "-c", "pgrep ffmpeg || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"