File size: 1,612 Bytes
2212f7c
 
 
 
 
 
 
 
 
 
 
 
 
6b56c00
 
 
2212f7c
 
 
 
 
 
 
 
 
 
 
 
6367463
 
 
 
 
1a8d064
6367463
 
 
 
 
 
 
 
11ae990
6367463
 
7f28959
 
11ae990
 
 
6367463
 
2828128
6367463
 
0d6e354
6367463
ca78a3b
 
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
# ---- Builder stage ----
FROM debian:bookworm-slim AS builder

RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    git \
    curl \
    libcurl4-openssl-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /build

# Pin a known-good release that supports --jinja.
# Verify current tags at https://github.com/ggml-org/llama.cpp/releases before bumping.
RUN git clone --depth 1 --branch b10107 https://github.com/ggml-org/llama.cpp.git

WORKDIR /build/llama.cpp

# Build with CPU-only, no CUDA, statically linked (no .so files to manage)
RUN cmake -B build \
    -DGGML_NATIVE=ON \
    -DGGML_CUDA=OFF \
    -DLLAMA_CURL=ON \
    -DBUILD_SHARED_LIBS=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    && cmake --build build --config Release -j2 --target llama-server

# ---- Runtime stage ----
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y \
    libcurl4 \
    libgomp1 \
    ca-certificates \
    curl \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY --from=builder /build/llama.cpp/build/bin/llama-server /app/llama-server

ARG MODEL_URL=https://huggingface.co/bartowski/Qwen2.5-3B-Instruct-GGUF/resolve/main/Qwen2.5-3B-Instruct-Q4_K_M.gguf
RUN curl -L -o /app/model.gguf "${MODEL_URL}"

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:7860/health || exit 1

CMD ["/app/llama-server", \
     "-m", "/app/model.gguf", \
     "--host", "0.0.0.0", \
     "--port", "7860", \
     "--threads", "2", \
     "--ctx-size", "24576", \
     "-ngl", "0", \
     "--batch-size", "512", \
     "--jinja"]