version: '3.9'
services:

  # RabbitMQ Service
  rabbitmq-service:
    container_name: rabbitmq-service
    image: rabbitmq:management
    ports:
      - "15672:15672"
      - "5672:5672"
    environment:
      RABBITMQ_DEFAULT_USER: "admin"
      RABBITMQ_DEFAULT_PASS: "admin"
    volumes:
      - rabbitmq-data:/var/lib/rabbitmq/
    healthcheck: 
      test: rabbitmq-diagnostics -q ping
      interval: 10s
      timeout: 10s
      retries: 10 
    networks:
      - snrt-network

  # Video Service
  video-service:
    container_name: video-service
    image: video-service:latest
    build:
      context: ./backend/video-service
      target: development
      dockerfile: docker/app/Dockerfile
    ports:
      - "8001:5000"
    volumes:
      - ./backend/video-service/src:/app
    env_file:
      - ./backend/video-service/src/.env
    depends_on:
      rabbitmq-service:
        condition: service_healthy
    networks:
      - snrt-network

  # Worker Service
  worker-service:
    container_name: worker-service
    image: video-service:latest
    command: celery -A app.tasks.worker worker --beat -l info -E
    volumes:
      - ./backend/video-service/src:/app
    env_file:
      - ./backend/video-service/src/.env
    depends_on:
      - video-service
      # video-service:
      #   condition: service_healthy
    networks:
      - snrt-network



volumes:
  rabbitmq-data:

networks:
  snrt-network:
    driver: bridge