File size: 1,211 Bytes
2b68af5
36f2737
72d1fbf
2b68af5
52ce0f9
ac7d7a0
2b68af5
7e0d71e
52ce0f9
0c2e09d
52ce0f9
7e0d71e
 
ac7d7a0
 
2b68af5
72d1fbf
36f2737
2b68af5
 
 
72d1fbf
2b68af5
ac7d7a0
2b68af5
0c2e09d
7e0d71e
2b68af5
0c2e09d
2b68af5
 
 
 
 
 
 
 
 
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
# Stage 1: Extract binaries from official llama.cpp image
FROM ghcr.io/ggml-org/llama.cpp:full AS llama

# Stage 2: Lightweight runtime image
FROM ubuntu:22.04

# Install minimal dependencies
RUN apt-get update && apt-get install -y \
    wget \
    ca-certificates \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy the server binary (this should exist in :full)
COPY --from=llama /app/llama-server /app/llama-server

# Copy shared libraries - try main locations, separate lines to avoid errors
# If one fails, Docker will still continue (no || needed here)
COPY --from=llama /app/*.so /usr/lib/ || true
COPY --from=llama /usr/local/lib/*.so /usr/lib/ || true
COPY --from=llama /usr/lib/*.so /usr/lib/ || true   # extra safe

# Download your Qwen2.5-3B Q4 model
RUN wget https://huggingface.co/Qwen/Qwen2.5-3B-Instruct-GGUF/resolve/main/qwen2.5-3b-instruct-q4_k_m.gguf -O model.gguf

# Expose port for the server
EXPOSE 7860

# Run the server with good defaults for CPU (adjust -t and -c as needed)
CMD ["./llama-server", \
     "-m", "model.gguf", \
     "--host", "0.0.0.0", \
     "--port", "7860", \
     "-c", "4096", \
     "-t", "6", \
     "--n-gpu-layers", "0"]   # 0 = CPU only