services:
  fooocus-api:
    image: docker.io/konieshadow/fooocus-api:latest
    container_name: fooocus-api
    ports:
      - "8888:8888"

    environment:
      # GPU config
      NVIDIA_VISIBLE_DEVICES: all
      NVIDIA_DRIVER_CAPABILITIES: compute,utility

    devices:
      - /dev/nvidia0:/dev/nvidia0
      - /dev/nvidiactl:/dev/nvidiactl
      - /dev/nvidia-uvm:/dev/nvidia-uvm

    # Utiliser root pour éviter les PermissionError
    user: "0:0"

    volumes:
      # 📂 Dossiers de modèles
      - ./models/checkpoints:/app/repositories/Fooocus/models/checkpoints:rw
      - ./models/clip:/app/repositories/Fooocus/models/clip:rw  
      - ./models/clip_vision:/app/repositories/Fooocus/models/clip_vision:rw       
      - ./models/configs:/app/repositories/Fooocus/models/configs:rw     
      - ./models/controlnet:/app/repositories/Fooocus/models/controlnet:rw      
      - ./models/diffuser:/app/repositories/Fooocus/models/diffuser:rw      
      - ./models/embeddings:/app/repositories/Fooocus/models/embeddings:rw  
      - ./models/gligen:/app/repositories/Fooocus/models/gligen:rw  
      - ./models/hypernetworks:/app/repositories/Fooocus/models/hypernetworks:rw    
      - ./models/inpaint:/app/repositories/Fooocus/models/inpaint:rw 
      - ./models/loras:/app/repositories/Fooocus/models/loras:rw
      - ./models/prompt_expansion:/app/repositories/Fooocus/models/prompt_expansion:rw
      - ./models/safety_checker:/app/repositories/Fooocus/models/safety_checker:rw
      - ./models/sam:/app/repositories/Fooocus/models/sam:rw
      - ./models/style_models:/app/repositories/Fooocus/models/style_models:rw
      - ./models/unet:/app/repositories/Fooocus/models/unet:rw
      - ./models/upscale_models:/app/repositories/Fooocus/models/upscale_models:rw
      - ./models/vae:/app/repositories/Fooocus/models/vae:rw
      - ./models/vae_approx:/app/repositories/Fooocus/models/vae_approx:rw

      # 📂 Résultats générés
      - ./outputs:/app/outputs:rw

      # Optionnel : monte le dossier complet des modèles pour compatibilité
      - ./models:/app/repositories/Fooocus/models:rw

    restart: unless-stopped
