FROM ollama/ollama:latest # Create a user and set up permissions RUN useradd -ms /bin/bash ollama-user # Set the home directory ENV HOME=/home/ollama-user WORKDIR $HOME # Ensure the user has access to the directory RUN mkdir -p $HOME/.ollama && chown -R ollama-user:ollama-user $HOME/.ollama # Switch to the new user USER ollama-user ENV OLLAMA_HOST=0.0.0.0:7860 ENTRYPOINT ollama CMD ["serve"] # Expose port 8050 # EXPOSE $SPACE_HOST # # Start the Ollama server # CMD ["/usr/local/bin/ollama", "serve", "--port", $SPACE_HOST]