services:
  ollama:
    image: ollama/ollama:latest
    container_name: kcg-ollama
    restart: unless-stopped
    ports:
      - "11434:11434"
    volumes:
      - /home/kcg-ollama/data:/root/.ollama
    deploy:
      resources:
        limits:
          memory: 64G
        reservations:
          memory: 40G
    environment:
      - OLLAMA_NUM_PARALLEL=4
      - OLLAMA_MAX_LOADED_MODELS=1
      - OLLAMA_KEEP_ALIVE=24h
      - OLLAMA_FLASH_ATTENTION=1
      - OLLAMA_NUM_THREADS=48
