# Use the latest version of the ollama image FROM ollama/ollama:latest # Install curl and create a user RUN apt-get update && \ apt-get install -y curl && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ useradd -m -u 1000 user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ OLLAMA_HOST=0.0.0.0 \ OLLAMA_ORIGINS=* # Set the working directory and switch to the user WORKDIR $HOME/app USER user COPY --chown=user:user entrypoint.sh $HOME/app/ # Make the entrypoint script executable RUN chmod +x $HOME/app/entrypoint.sh # Expose the port for the Ollama server EXPOSE 11434 # Set the entrypoint to the entrypoint script ENTRYPOINT ["./entrypoint.sh"]