
services:
  nginx:
    build:
      context: ./nginx
    ports:
      - "1935:1935"  # RTMP
      - "8080:8080"
    depends_on:
      - frontend
      - web_server
    networks:
      - app_network
    volumes:
      - stream_data:/stream_data
  web_server:
    build:
      context: ./web_server
    ports:
      - "5000:5000"
    networks:
      - app_network
    env_file:
      - .env
    environment:
      - FLASK_APP=blueprints.__init__
      - FLASK_ENV=production
    volumes:
      - stream_data:/web_server/stream_data

  frontend:
    build:
      context: ./frontend
    ports:
      - "5173"
    networks:
      - app_network
    environment:
      - VITE_API_URL=/api
    depends_on:
      - web_server

  redis:
    image: "redis:alpine"
    ports:
      - "6379:6379"
    networks:
      - app_network

  celery:
    build:
      context: ./web_server
    command: celery -A celery_tasks.celery_app worker --loglevel=info
    depends_on:
      - redis
    volumes:
      - .:/app
      - stream_data:/web_server/stream_data
    networks:
      - app_network
      
networks:
  app_network:
    driver: bridge

volumes:
  stream_data: