FROM python:3.11-slim RUN apt-get update && apt-get install -y \ curl \ ca-certificates \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir gradio requests RUN useradd -m -u 1000 user RUN curl -fsSL https://ollama.com/install.sh | sh USER user ENV HOME=/home/user WORKDIR $HOME/app ENV OLLAMA_HOST=0.0.0.0 ENV OLLAMA_MODELS=$HOME/.ollama/models COPY --chown=user:user app.py . COPY --chown=user:user entrypoint.sh . RUN chmod +x entrypoint.sh EXPOSE 7860 CMD ["bash", "entrypoint.sh"]