Create Dockerfile
Browse files- Dockerfile +38 -0
Dockerfile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Serve an already-GGUF model with prebuilt llama.cpp binaries (no compile, no convert -> fast).
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 5 |
+
PYTHONUNBUFFERED=1 \
|
| 6 |
+
HF_HOME=/home/user/.cache/huggingface \
|
| 7 |
+
HF_HUB_ENABLE_HF_TRANSFER=1
|
| 8 |
+
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
curl ca-certificates libgomp1 \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 12 |
+
&& useradd -m -u 1000 user
|
| 13 |
+
|
| 14 |
+
# ---- Prebuilt llama.cpp CPU binaries: llama-server + shared libs (NO build) ----
|
| 15 |
+
# Use a recent release (b9664) so the brand-new Qwen3.5 hybrid (linear+full) attention
|
| 16 |
+
# architecture of this 0.8B model is supported by the runtime.
|
| 17 |
+
RUN mkdir -p /opt/llamabin && cd /opt/llamabin \
|
| 18 |
+
&& curl -fsSL -o l.tar.gz \
|
| 19 |
+
https://github.com/ggml-org/llama.cpp/releases/download/b9664/llama-b9664-bin-ubuntu-x64.tar.gz \
|
| 20 |
+
&& tar xzf l.tar.gz --strip-components=1 \
|
| 21 |
+
&& rm l.tar.gz \
|
| 22 |
+
&& chmod +x /opt/llamabin/llama-server
|
| 23 |
+
ENV LD_LIBRARY_PATH=/opt/llamabin \
|
| 24 |
+
PATH=/opt/llamabin:$PATH
|
| 25 |
+
|
| 26 |
+
# ---- Python deps: downloader + proxy only (no torch/transformers, no converter needed) ----
|
| 27 |
+
RUN pip install --no-cache-dir \
|
| 28 |
+
huggingface_hub hf_transfer \
|
| 29 |
+
"fastapi>=0.110" "uvicorn[standard]>=0.27" requests
|
| 30 |
+
|
| 31 |
+
WORKDIR /home/user/app
|
| 32 |
+
COPY app.py .
|
| 33 |
+
COPY chat_template.jinja .
|
| 34 |
+
RUN chown -R user:user /home/user
|
| 35 |
+
|
| 36 |
+
USER user
|
| 37 |
+
EXPOSE 7860
|
| 38 |
+
CMD ["python", "app.py"]
|