# Fully local variant: adds Ollama next to MariaDB and ByteChef.
# Use it together with the main file:
#   docker compose -f docker-compose.yml -f docker-compose.ollama.yml up -d
# In ByteChef, create an Ollama connection with URL http://ollama:11434.
services:
  ollama:
    image: ollama/ollama:latest
    volumes:
      - ollama_models:/root/.ollama
    ports:
      - "11434:11434"
    healthcheck:
      test: ["CMD", "ollama", "list"]
      interval: 10s
      timeout: 5s
      retries: 10

  # One-off job that downloads the embedding and chat models, then exits.
  ollama-pull:
    image: ollama/ollama:latest
    depends_on:
      ollama:
        condition: service_healthy
    environment:
      OLLAMA_HOST: http://ollama:11434
    entrypoint: ["/bin/sh", "-c", "ollama pull nomic-embed-text && ollama pull llama3.1"]
    restart: "no"

  bytechef:
    depends_on:
      ollama:
        condition: service_healthy

volumes:
  ollama_models:
