File size: 888 Bytes
ac100ab
 
fe5f6d7
 
4c12b60
 
 
fe5f6d7
 
 
 
 
 
ac100ab
4c12b60
fe5f6d7
ac100ab
 
 
 
 
4c12b60
fe5f6d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM python:3.11-slim

# 仅保留基础运行环境
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# --- 极致提速:直接下载预编译好的包 ---
# 这里的 URL 指向了通用 Linux x86_64 的预编译版本
RUN pip install --no-cache-dir \
    https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.7/llama_cpp_python-0.3.7-cp311-cp311-linux_x86_64.whl

# 安装服务器依赖
RUN pip install --no-cache-dir "llama-cpp-python[server]"

# 下载模型
RUN wget -q https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct-GGUF/resolve/main/smollm2-135m-instruct-q8_0.gguf

ENV HOST=0.0.0.0
ENV PORT=7860
ENV MODEL=/app/smollm2-135m-instruct-q8_0.gguf

ENTRYPOINT ["python3", "-m", "llama_cpp.server", "--model", "/app/smollm2-135m-instruct-q8_0.gguf", "--host", "0.0.0.0", "--port", "7860", "--chat_format", "chatml"]