| # 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) ---- | |
| RUN mkdir -p /opt/llamabin && cd /opt/llamabin \ | |
| && curl -fsSL -o l.tar.gz \ | |
| https://github.com/ggml-org/llama.cpp/releases/download/b9670/llama-b9670-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 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"] | |