name: openwebui

services:
  openwebui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: openwebui
    volumes:
      - open-webui:/app/backend/data
    ports:
      - "8082:8080"
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
      - WEBUI_SECRET_KEY=${WEBUI_SECRET_KEY}
      - WEBUI_NAME=${WEBUI_NAME:-Open WebUI}
      - WEBUI_URL=${WEBUI_URL:-http://localhost:8082}
      - WEBUI_AUTH=${WEBUI_AUTH:-True}
      - ENABLE_SIGNUP=${ENABLE_SIGNUP:-True}
      - DEFAULT_USER_ROLE=${DEFAULT_USER_ROLE:-user}
    depends_on:
      - ollama
    networks:
      - mozart-network
      - openwebui-network
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.openwebui.rule=Host(`${SERVER_NAME}`)"
      - "traefik.http.routers.openwebui.entrypoints=websecure"
      - "traefik.http.routers.openwebui.tls=true"
      - "traefik.http.services.openwebui.loadbalancer.server.port=8080"
      - "traefik.docker.network=mozart-network"

  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    ports:
      - "11434:11434"
    volumes:
      - ollama:/root/.ollama
    networks:
      - openwebui-network
    restart: unless-stopped
    # Décommentez les lignes suivantes si vous avez un GPU NVIDIA
    # deploy:
    #   resources:
    #     reservations:
    #       devices:
    #         - driver: nvidia
    #           count: 1
    #           capabilities: [gpu]

networks:
  openwebui-network:
    driver: bridge
  mozart-network:
    external: true

volumes:
  open-webui:
    driver: local
  ollama:
    driver: local 