File size: 986 Bytes
6056414
 
 
d688e4a
 
 
 
 
 
6056414
 
 
d688e4a
6056414
d688e4a
919822e
6056414
d688e4a
6056414
 
d688e4a
6056414
 
d688e4a
 
6056414
 
 
 
 
 
 
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
# Use a lightweight base image with Python
FROM python:3.10-slim

# 1. Install system dependencies (Build tools + wget)
RUN apt-get update && apt-get install -y \
    build-essential \
    cmake \
    wget \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# 2. Install llama-cpp-python with CPU wheel preference
RUN pip install --no-cache-dir \
    "llama-cpp-python[server]" \
    --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu

# 3. Download the Qwen 2.5 Coder GGUF model
RUN wget https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf

# 4. Expose the port HF Spaces expects
EXPOSE 7860

# 5. Run the server
# Note: HF Free tier has 2 vCPUs, so --n_threads 2 is best.
CMD ["python3", "-m", "llama_cpp.server", \
     "--model", "qwen2.5-coder-7b-instruct-q4_k_m.gguf", \
     "--host", "0.0.0.0", \
     "--port", "7860", \
     "--n_threads", "2", \
     "--n_gpu_layers", "0", \
     "--n_ctx", "4096"]