version: '3.9'

services:
  ollama:
    image: ollama/ollama:0.1.46
    ports:
      - target: 11434
        published: 11434
        mode: host
    volumes:
      - ollama_models:/root/.ollama
    networks:
      - traefik-public
    deploy:
      labels:
        - traefik.enable=true
        - traefik.http.routers.ollama.rule=Host(`ollama.localhost`)
        - traefik.http.routers.ollama.entrypoints=websecure
        - traefik.http.routers.ollama.tls=true
        - traefik.http.services.ollama.loadbalancer.server.port=11434

volumes:
  ollama_models:
    driver: local
    driver_opts:
      type: nfs
      o: addr=omv800.local,nolock,soft,rw
      device: :/export/ollama/models

networks:
  traefik-public:
    external: true
