# Hugging Face Docker Space — optional GPU path (prebuilt wheel, no source compile). # Default public Space uses Gradio SDK; see README.md sdk: gradio. ARG CUDA_IMAGE=12.4.1-runtime-ubuntu22.04 FROM nvidia/cuda:${CUDA_IMAGE} ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ SYSTEM=spaces \ HF_HUB_ENABLE_HF_TRANSFER=1 RUN apt-get update && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY . /app RUN grep -v '^llama-cpp-python' requirements.txt > /tmp/requirements-core.txt \ && pip3 install --no-cache-dir -r /tmp/requirements-core.txt # Prebuilt CUDA wheel — avoids OOM from compiling llama-cpp-python at build time. # >= 0.3.25 required for Nemotron 3 Nano (nemotron_h) GGUF support. RUN pip3 install --no-cache-dir "llama-cpp-python==0.3.29" \ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu124 RUN chmod +x /app/scripts/space_entrypoint.sh ENV PMS_INFERENCE_BACKEND=llamacpp \ PMS_LLAMACPP_MODE=embedded \ PMS_USE_FINETUNED=true \ PMS_FINETUNED_MODEL=GuusBouwensNL/plane-mode-nemotron-4b-study-coach \ PMS_LORA_GGUF_MODEL=GuusBouwensNL/plane-mode-study-coach-lora-gguf \ PMS_GGUF_DIR=/data/models/nemotron \ PMS_LLAMACPP_N_GPU_LAYERS=-1 \ GRADIO_SERVER_NAME=0.0.0.0 RUN useradd -m -u 1000 user && chown -R user:user /app USER user ENV HOME=/home/user PATH=/home/user/.local/bin:${PATH} EXPOSE 7860 CMD ["/app/scripts/space_entrypoint.sh"]