FROM ollama/ollama:latest USER root # Install curl for health checks RUN apt-get update && \ apt-get install -y --no-install-recommends curl && \ rm -rf /var/lib/apt/lists/* # Force Ollama to bind on 0.0.0.0:7860 ENV OLLAMA_HOST=0.0.0.0:7860 # Store models inside the container ENV OLLAMA_MODELS=/root/.ollama/models # Disable GPU (free tier = CPU only) ENV OLLAMA_NUM_GPU=0 # Keep model loaded in memory permanently ENV OLLAMA_KEEP_ALIVE=-1 EXPOSE 7860 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]