dow-prod-tracker/docker/ollama-entrypoint.sh
Leivur Djurhuus e5b398d7da feat: Implement automation event bus and rule engine
- Add event bus for dispatching automation events with handlers.
- Create rule engine to evaluate events against defined triggers.
- Introduce chat provider to interface with Claude API and Ollama fallback.
- Define tool schemas for Claude-compatible operations.
- Implement tool executor to map tool calls to service layer functions.
- Develop automation service for CRUD operations on rules and event handling.
2026-03-12 11:20:21 -05:00

39 lines
950 B
Bash

#!/bin/bash
# Ollama entrypoint — starts the server and pulls required models on first run.
# Models are cached in the Docker volume, so subsequent starts skip the pull.
set -e
echo "Starting Ollama server..."
ollama serve &
OLLAMA_PID=$!
# Wait for server to be ready
echo "Waiting for Ollama to be ready..."
for i in $(seq 1 30); do
if curl -s http://localhost:11434/api/tags > /dev/null 2>&1; then
echo "Ollama is ready."
break
fi
sleep 1
done
# Pull required models if not already present
pull_if_missing() {
local model=$1
if ollama list 2>/dev/null | grep -q "$model"; then
echo "Model '$model' already available."
else
echo "Pulling model '$model'... (this may take a few minutes on first run)"
ollama pull "$model"
echo "Model '$model' pulled successfully."
fi
}
pull_if_missing "nomic-embed-text"
pull_if_missing "qwen3:1.7b"
echo "All models ready."
# Keep the server running
wait $OLLAMA_PID