#!/bin/sh set -e # Try to start Ollama if available if command -v ollama >/dev/null 2>&1; then echo "Starting Ollama..." ollama serve & OLLAMA_PID=$! # Wait for Ollama to be ready (max 30s) 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 if ! curl -s http://localhost:11434/api/tags >/dev/null 2>&1; then echo "Warning: Ollama failed to start, continuing without it" fi else echo "Ollama not installed, starting without local LLM backend" fi # Start the API server echo "Starting GBridge PhoneGPU API..." exec python -m uvicorn app.main:app --host 0.0.0.0 --port 7860