Spaces:
Running
Running
| FROM python:3.10-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| python3-dev \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set up the Hugging Face standard user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # CRITICAL FIX: Tell pip NOT to use a cached build, and enforce a clean wheel | |
| ENV PIP_PREFER_BINARY=1 | |
| # Install llama-cpp-python using pre-compiled wheels for CPU | |
| RUN pip install --no-cache-dir llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu | |
| # Copy requirements and install the remaining packages (FastAPI, etc.) | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY --chown=user app.py . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] |