FROM ollama/ollama # 1. User & Permissions setup RUN mkdir -p /home/user/.ollama RUN chown -R 1000:1000 /home/user ENV HOME=/home/user # 2. Network Config ENV OLLAMA_HOST=0.0.0.0:7860 ENV OLLAMA_ORIGINS=* # 3. CRITICAL OPTIMIZATIONS for 2-3 Users # Parallel: Allows 2 requests to run at the exact same time. ENV OLLAMA_NUM_PARALLEL=2 # Keep Alive: Never unload the model from RAM (keeps it ready instantly). ENV OLLAMA_KEEP_ALIVE=-1 # Max Models: Force Ollama to focus only on this one model to save RAM. ENV OLLAMA_MAX_LOADED_MODELS=1 # 4. Switch to user USER 1000 EXPOSE 7860 # 5. Start, optimize, and keep running # We use 'qwen3:0.6b' (or the specific tag you need) ENTRYPOINT ["/bin/sh", "-c", "ollama serve & sleep 10 && ollama pull qwen2.5:0.5b && wait"]