# StackShip — Ollama Stack
# Generated by: stackship deploy ollama
# Docs: https://github.com/ai-engineering-lab/stackship

version: "3.8"

services:
  ollama:
    image: ollama/ollama:latest
    container_name: stackship-ollama
    restart: unless-stopped
{% if gpu %}
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
{% endif %}
    volumes:
      - ollama_models:/root/.ollama
    ports:
      - "11434:11434"
    networks:
      - stackship

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: stackship-open-webui
    restart: unless-stopped
    ports:
      - "{{ gateway_port | default('3000') }}:8080"
    volumes:
      - open_webui_data:/app/backend/data
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
{% for key, value in env_vars.items() %}
      - {{ key }}={{ value }}
{% endfor %}
    depends_on:
      - ollama
    networks:
      - stackship

volumes:
  ollama_models:
  open_webui_data:

networks:
  stackship:
    driver: bridge
