Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files12345678910FROM ghcr.io/ggml-org/llama.cpp:serverEXPOSE 7860CMD ["--hf-repo", "Qwen/Qwen2.5-3B-Instruct-GGUF", \"--hf-file", "qwen2.5-3b-instruct-q4_k_m.gguf", \"--port", "7860", \"--host", "0.0.0.0", \"--chat-template", "chatml", \"-c", "8192"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657FROM debian:bookworm-slim AS builderRUN 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; bump as neededRUN git clone --depth 1 --branch b3600 https://github.com/ggerganov/llama.cpp.gitWORKDIR /build/llama.cpp# Build with CPU-only, no CUDA. Enable native arch optimizations (AVX2 etc if host supports it)RUN cmake -B build \-DGGML_NATIVE=ON \-DGGML_CUDA=OFF \-DLLAMA_CURL=ON \-DCMAKE_BUILD_TYPE=Release \&& cmake --build build --config Release -j2 --target llama-server# ---- Runtime stage ----FROM debian:bookworm-slimRUN apt-get update && apt-get install -y \libcurl4 \ca-certificates \curl \&& rm -rf /var/lib/apt/lists/*WORKDIR /appCOPY --from=builder /build/llama.cpp/build/bin/llama-server /app/llama-server# Pull the GGUF model at build time (Q4_K_M quant, ~1GB for 1.5B model)# Swap this URL for whichever quant repo you land on (e.g. bartowski/Qwen2.5-1.5B-Instruct-GGUF)ARG MODEL_URL=https://huggingface.co/bartowski/Qwen2.5-1.5B-Instruct-GGUF/resolve/main/Qwen2.5-1.5B-Instruct-Q4_K_M.ggufRUN curl -L -o /app/model.gguf "${MODEL_URL}"# HF Spaces expects the app to listen on port 7860EXPOSE 7860# --threads 2 to match vCPU count, avoid oversubscription# --ctx-size kept small since bot commands are short# -ngl 0 forces CPU-only (no GPU layers offloaded)CMD ["/app/llama-server", \"-m", "/app/model.gguf", \"--host", "0.0.0.0", \"--port", "7860", \"--threads", "2", \"--ctx-size", "2048", \"-ngl", "0", \"--batch-size", "512"]
Dockerfile+53-6