Spaces:
Paused
Paused
File size: 2,203 Bytes
ea5d56a c5c5d80 ea5d56a 687f798 ea5d56a e24791f ea5d56a 687f798 e24791f 5c59b5e 687f798 e24791f 687f798 ea5d56a c5c5d80 7cc60cb 0656d63 687f798 21cc5dd c5c5d80 e24791f 687f798 ea5d56a 687f798 c5c5d80 687f798 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # Ubuntu 24.04 base to match the glibc of the official llama.cpp release binary.
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
# Runtime deps only (no compiler/cmake — we use the prebuilt binary).
# libgomp1 : OpenMP threading used by ggml-cpu
# libcurl4 : llama-server is built with curl support
RUN apt-get update && apt-get install -y \
curl \
ca-certificates \
libgomp1 \
libcurl4 \
python3 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Python runtime deps (thin FastAPI proxy)
RUN pip install --no-cache-dir --break-system-packages \
fastapi \
uvicorn \
httpx \
huggingface_hub
# ---------------------------------------------------------------------------
# Prebuilt llama.cpp CPU server — NO source compile (avoids the multimodal/mtmd
# OOM that hangs a from-source build on a 2-vCPU builder). The ubuntu-x64 build
# ships per-microarch CPU variants (haswell/skylakex/icelake/...) and selects the
# best one at RUNTIME, so it is portable and safe on cpu-basic.
# ---------------------------------------------------------------------------
ARG LLAMA_TAG=b9895
RUN mkdir -p /llama.cpp/build/bin \
&& curl -fsSL -o /tmp/llama.tar.gz \
"https://github.com/ggml-org/llama.cpp/releases/download/${LLAMA_TAG}/llama-${LLAMA_TAG}-bin-ubuntu-x64.tar.gz" \
&& tar -xzf /tmp/llama.tar.gz -C /llama.cpp/build/bin --strip-components=1 \
&& rm /tmp/llama.tar.gz \
&& chmod +x /llama.cpp/build/bin/llama-server \
&& /llama.cpp/build/bin/llama-server --version 2>&1 | head -5
# llama-server finds its sibling .so files here.
ENV LD_LIBRARY_PATH=/llama.cpp/build/bin
WORKDIR /app
# Models directory (model is pulled at container startup by app.py, not baked
# into the image — keeps the build fast and avoids download hangs during build).
RUN mkdir -p /models && chmod -R 777 /models
COPY . .
# Single instance: main proxy (7860) + one llama.cpp server (8081)
EXPOSE 7860 8081
# Longer start-period: the model (~5.5GB) is pulled on first container start.
HEALTHCHECK --interval=30s --timeout=10s --start-period=420s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
CMD ["python3", "app.py"]
|