# Serve an already-GGUF model with prebuilt llama.cpp binaries (no compile, no convert -> fast). FROM python:3.11-slim ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ HF_HOME=/home/user/.cache/huggingface \ HF_HUB_ENABLE_HF_TRANSFER=1 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates libgomp1 \ && rm -rf /var/lib/apt/lists/* \ && useradd -m -u 1000 user # ---- Prebuilt llama.cpp CPU binaries: llama-server + shared libs (NO build) ---- # Use a recent release (b9664) so the brand-new Qwen3.5 hybrid (linear+full) attention # architecture of this 0.8B model is supported by the runtime. RUN mkdir -p /opt/llamabin && cd /opt/llamabin \ && curl -fsSL -o l.tar.gz \ https://github.com/ggml-org/llama.cpp/releases/download/b9664/llama-b9664-bin-ubuntu-x64.tar.gz \ && tar xzf l.tar.gz --strip-components=1 \ && rm l.tar.gz \ && chmod +x /opt/llamabin/llama-server ENV LD_LIBRARY_PATH=/opt/llamabin \ PATH=/opt/llamabin:$PATH # ---- Python deps: downloader + proxy only (no torch/transformers, no converter needed) ---- RUN pip install --no-cache-dir \ huggingface_hub hf_transfer \ "fastapi>=0.110" "uvicorn[standard]>=0.27" requests WORKDIR /home/user/app COPY app.py . COPY chat_template.jinja . RUN chown -R user:user /home/user USER user EXPOSE 7860 CMD ["python", "app.py"]