FROM python:3.11-slim WORKDIR /app # System build deps for llama-cpp-python (CPU + OpenBLAS for speed) RUN apt-get update && apt-get install -y \ build-essential \ cmake \ libopenblas-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Install Python deps — compile llama-cpp-python with OpenBLAS COPY requirements.txt . RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" \ FORCE_CMAKE=1 \ pip install --no-cache-dir -r requirements.txt COPY app.py . # HuggingFace Spaces expects port 7860 EXPOSE 7860 # Set SPACE_URL at runtime via HF Space secrets/env vars ENV SPACE_URL="" ENV N_CTX="8192" ENV N_THREADS="2" CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]