FROM python:3.11-slim WORKDIR /app # Install build tools for llama-cpp-python (C++ compiler) RUN apt-get update && apt-get install -y g++ build-essential cmake curl && rm -rf /var/lib/apt/lists/* COPY requirements.txt . # Force single-threaded compilation to prevent OOMKilled on Hugging Face Spaces ENV CMAKE_BUILD_PARALLEL_LEVEL=1 ENV MAKEFLAGS="-j1" RUN pip install --no-cache-dir -r requirements.txt COPY . . # Hugging Face exposes port 7860 EXPOSE 7860 CMD ["python", "main.py"]