# 1. Base Image FROM ghcr.io/open-webui/open-webui:main # 2. Environment Variables ENV PORT=7860 ENV OLLAMA_BASE_URL=http://127.0.0.1:11434 # 3. Switch to root USER root # 4. Install dependencies RUN apt-get update && apt-get install -y zstd curl # 5. Install Ollama RUN curl -fsSL https://ollama.com/install.sh | sh # 6. Create startup script RUN echo '#!/bin/bash\n\ set -e\n\ \n\ echo "Starting Ollama..."\n\ ollama serve &\n\ \n\ echo "Waiting for Ollama to be ready..."\n\ until curl -s http://127.0.0.1:11434 > /dev/null; do\n\ sleep 2\n\ done\n\ \n\ echo "Ollama is ready. Starting Open WebUI..."\n\ exec /app/backend/start.sh\n\ ' > /start.sh && chmod +x /start.sh # 7. Run CMD ["/start.sh"]