Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # ---- System dependencies (zstd is required by Ollama installer) ---- | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| curl \ | |
| ca-certificates \ | |
| procps \ | |
| zstd && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # ---- Install Ollama ---- | |
| RUN curl -fsSL https://ollama.com/install.sh | sh | |
| # ---- Create non-root user (HF Spaces requirement) ---- | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /home/user/app | |
| # ---- Python dependencies ---- | |
| COPY --chown=1000 requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # ---- Copy app files ---- | |
| COPY --chown=1000 . . | |
| RUN chmod +x start.sh | |
| # ---- Switch to non-root user ---- | |
| USER user | |
| ENV HOME=/home/user \ | |
| OLLAMA_MODELS=/home/user/.ollama/models | |
| EXPOSE 7860 | |
| CMD ["bash", "start.sh"] |