FROM ollama/ollama:latest # Use the existing user (ID 1000) that is already in the Ollama image ENV HOME=/home/ollama \ PATH=/home/ollama/.local/bin:$PATH # Create the app directory and set permissions WORKDIR $HOME/app RUN chown -R 1000:1000 $HOME # Configure Ollama for Hugging Face (Port 7860 is the key) ENV OLLAMA_HOST=0.0.0.0:7860 ENV OLLAMA_ORIGINS="*" # Copy the startup script (ensure start.sh is in the same folder as this Dockerfile) COPY start.sh start.sh RUN chmod +x start.sh # Switch to the user (Hugging Face expects user 1000) USER 1000 EXPOSE 7860 ENTRYPOINT ["./start.sh"]