# docker-compose.yml
version: '3.8'

services:
  # MobileFaceNet Python Service
  face-recognition:
    build:
      context: ./python-service
      dockerfile: Dockerfile
    ports:
      - "5000:5000"
    environment:
      - MYSQL_HOST=mysql
      - REDIS_HOST=redis
      - DEBUG=False
    volumes:
      - ./python-service:/app
      - ./weights:/app/weights
    depends_on:
      - mysql
      - redis
    networks:
      - app-network

  # MySQL Database
  mysql:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: uni_attendance
    ports:
      - "3306:3306"
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - app-network

  # Redis Cache
  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    networks:
      - app-network

  # Laravel Application
  laravel:
    build:
      context: ./laravel
      dockerfile: Dockerfile
    ports:
      - "8000:80"
    environment:
      - DB_HOST=mysql
      - REDIS_HOST=redis
      - FACE_API_URL=http://face-recognition:5000
    volumes:
      - ./laravel:/var/www/html
    depends_on:
      - mysql
      - redis
      - face-recognition
    networks:
      - app-network

networks:
  app-network:
    driver: bridge

volumes:
  mysql-data:
