version: '3'

services:

  # Stream Capture Container
  stream-capture:  # Service name for the Stream Capture Container
    build:
      context: .  # Build context (use current directory)
      dockerfile: docker/Dockerfile  # Path to Dockerfile for Stream Capture Container
    image: stream-capture:latest  # Docker image name and tag
    container_name: StreamCaptureContainer  # Container name
    volumes:
      - ./data/hls:/app/data/hls                 # Mount HLS directory
      - ./data/hls/segments:/app/data/hls/segments  # Mount HLS segments directory
      - ./data/capture.log:/app/data/capture.log      # Mount capture log file
    environment:
      - STREAM_URL="https://cdnamd-hls-globecast.akamaized.net/live/ramdisk/2m_monde/hls_video_ts_tuhawxpiemz257adfc/2m_monde-avc1_1500000=4-mp4a_130400_qad=1.m3u8"
      # Define environment variables if needed
    command: ["sh", "/app/stream_capture.sh"]  # Command to run the stream capture script

  # Stream Listener Container
  stream-listener:  # Service name for the Stream Listener Container
    build:
      context: .  # Build context (use current directory)
      dockerfile: docker/Dockerfile  # Path to Dockerfile for Stream Listener Container
    image: stream-listener:latest  # Docker image name and tag
    container_name: StreamListenerContainer  # Container name
    volumes:
      - ./data/hls:/app/data/hls                 # Mount HLS directory
      - ./data/hls/segments:/app/data/hls/segments  # Mount HLS segments directory
      - ./data/listener.log:/app/data/listener.log  # Mount listener log file
    command: ["sh", "/app/stream_listener.sh"]
    depends_on:
      - stream-capture  # Ensure StreamCaptureContainer is started first

  # Ads Marker Container
  ads-marker:  # Service name for the Ads Marker Container
    build: 
      context: .  # Build context (use current directory)
      dockerfile: docker/Dockerfile  # Path to Dockerfile for Ads Marker Container
    image: ads-marker:latest  # Docker image name and tag
    container_name: AdsMarkerContainer  # Container name
    volumes:
      - ./data/hls:/app/data/hls                    # Mount HLS directory 
      - ./data/marker.log:/app/data/marker.log  # Mount listener log file
    command: ["sh", "/app/ads_marker.sh"]
    depends_on:
      - stream-capture  # Ensure StreamCaptureContainer is started first
      - stream-listener  # Ensure StreamListenerContainer is started first


  # redis:
  #   container_name: redis_1
  #   image: redis:7-alpine

  # celery_worker:
  #   container_name: celery_worker
  #   build:
  #     context: .
  #     dockerfile: docker/AdsMarker/Dockerfile

  #   command: "celery -A worker.tasks worker --loglevel=info"
  #   volumes:
  #     - ./data/hls:/app/data/hls                    # Mount HLS directory 
  #     - ./data/marker.log:/app/data/marker.log  # Mount listener log file

  #   depends_on:
  #     - redis

  # celery_beat:
  #   container_name: celery_beat_1
  #   build:
  #     context: .
  #     dockerfile: docker/AdsMarker/Dockerfile
  #   command: "celery -A worker.tasks beat --loglevel=info"
  #   volumes:
  #     - ./docker/AdsMarker/:/app/
  #   depends_on:
  #     - redis

  # flower:
  #   container_name: flowers
  #   build:
  #     context: .
  #   command: celery -A AdsMarker.tasks flower --port=5001
  #   ports:
  #     - 5001:5001
  #   depends_on:
  #     - redis

  # Stream Quality Container

  # Stream Monitor Container


