services:
  backend:
    image: ouijdaneim/ndf-backend:latest
    build:
      context: ./ndf/public/backend
      dockerfile: DockerfileNDF.backend
    container_name: ndf-backend
    environment:
      - DB_SERVER=192.168.0.3
      - DB_NAME=NDF
      - DB_USER=ndf_app
      - DB_PASSWORD=P@ssw0rd2026!
      - DB_PORT=1433
      - PORT=3024
      - AZURE_TENANT_ID=9840a2a0-6ae1-4688-b03d-d2ec291be0f9
      - AZURE_CLIENT_ID=51a2c5b3-4cea-4752-93d0-bc59ea33be29
      - AZURE_CLIENT_SECRET=uPD8Q~CJbl26DDrRWRgKXvvqwVVm0DtRhzkEqcyT
      - AZURE_GROUP_ID=c1ea877c-6bca-4f47-bfad-f223640813a0
      - JWT_SECRET=un_secret_aleatoire_securise
      - OAUTH_REDIRECT_URI=http://localhost:8024/api/auth/callback   # ✅
      - FRONTEND_URL=https://myndf.ensup-adm.net                      # ✅
      - SHAREPOINT_SITE_ID=ensup.sharepoint.com,d94abc08-28eb-47ce-8e12-fbbd6f16b9ea,a052c325-d33a-40e3-9e7b-7896a2ea7ab7
      - SHAREPOINT_DRIVE_ID=b!CLxK2esozkeOEvu9bxa56iXDUqA60-NAnnt4lqLqerfjKRsFHmtxSbj0s5KCssZK
    hostname: backend
    ports:
      - "8024:3024"
    networks:
      - ndf-network
    restart: unless-stopped
    extra_hosts:
      - "host.docker.internal:host-gateway"

  frontend:
    image: ouijdaneim/ndf-frontend:latest
    build:
      context: .
      dockerfile: DockerfileNDF.frontend
    container_name: ndf-frontend
    hostname: frontend
    ports:
      - "3025:81"
    environment:
      - VITE_API_URL=http://backend:3024
    networks:
      - ndf-network
    depends_on:
      - backend
    restart: unless-stopped

networks:
  ndf-network:
    name: ndf-network
    driver: bridge
