FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ HF_HOME=/data/.huggingface \ HUGGINGFACE_HUB_CACHE=/data/.cache/huggingface/hub \ # force llama-cpp-python CPU build CMAKE_ARGS="-DGGML_NATIVE=OFF" \ FORCE_CMAKE=1 WORKDIR /app # System deps to build llama-cpp-python RUN apt-get update && apt-get install -y --no-install-recommends \ git \ build-essential \ cmake \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /app/requirements.txt RUN pip install --upgrade pip setuptools wheel \ && pip install -r /app/requirements.txt COPY main.py /app/main.py COPY utils.py /app/utils.py EXPOSE 7860 # PORT is set by HF Spaces; default to 7860 locally CMD ["bash", "-lc", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]