version: "3.9"
services:
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
      args:
        # Set this to the server ip/domain, if your backend is deployed on a different server
        #VITE_BACKEND_URL: http://123.123.123.123:5000
        VITE_BACKEND_STREAMS_PATH: /streams/playlist.m3u8
        VITE_STREAM_DELAY: 18
    networks:
      - app-network

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    volumes:
      - streams_data:/streams
    environment:
      DEFAULT_CHANNEL_URL: https://mcdn.daserste.de/daserste/de/master.m3u8
      STORAGE_PATH: /streams
    networks:
      - app-network

  # Nginx Reverse Proxy
  nginx:
    image: nginx:alpine
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf
      - streams_data:/streams
    ports:
      - "80:80"
    networks:
      - app-network

volumes:
  streams_data:

# Internal docker network
networks:
  app-network:
    driver: bridge