1
0

audit: clean Docker architecture, consolidate test fixtures, add containerized test runner (#94)

This commit is contained in:
Alexander Whitestone
2026-02-28 16:11:58 -05:00
committed by GitHub
parent 1e19164379
commit d7d7a5a80a
24 changed files with 700 additions and 494 deletions

View File

@@ -2,11 +2,20 @@
# ── Ollama Initialization Script ──────────────────────────────────────────────
#
# Starts Ollama and pulls models on first run.
# Requires: curl (ships with the ollama image).
# jq is installed at runtime if missing so we can parse /api/tags reliably
# instead of fragile grep-based JSON extraction.
set -e
echo "🚀 Ollama startup — checking for models..."
# ── Ensure jq is available (ollama image is Debian-based) ────────────────────
if ! command -v jq &>/dev/null; then
echo "📦 Installing jq for reliable JSON parsing..."
apt-get update -qq && apt-get install -y -qq jq >/dev/null 2>&1 || true
fi
# Start Ollama in background
ollama serve &
OLLAMA_PID=$!
@@ -18,15 +27,26 @@ for i in {1..60}; do
echo "✓ Ollama is ready"
break
fi
if [ "$i" -eq 60 ]; then
echo "❌ Ollama failed to start after 60 s"
exit 1
fi
echo " Attempt $i/60..."
sleep 1
done
# Check if models are already present
# Check if models are already present (jq with grep fallback)
echo "📋 Checking available models..."
MODELS=$(curl -s http://localhost:11434/api/tags | grep -o '"name":"[^"]*"' | wc -l)
TAGS_JSON=$(curl -s http://localhost:11434/api/tags)
if [ "$MODELS" -eq 0 ]; then
if command -v jq &>/dev/null; then
MODELS=$(echo "$TAGS_JSON" | jq '.models | length')
else
# Fallback: count "name" keys (less reliable but functional)
MODELS=$(echo "$TAGS_JSON" | grep -o '"name"' | wc -l)
fi
if [ "${MODELS:-0}" -eq 0 ]; then
echo "📥 No models found. Pulling llama3.2..."
ollama pull llama3.2 || echo "⚠️ Failed to pull llama3.2 (may already be pulling)"
else