javaeeduke commited on
Commit
a75f40b
·
verified ·
1 Parent(s): 67c6ef2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -15
Dockerfile CHANGED
@@ -4,35 +4,29 @@ ENV DEBIAN_FRONTEND=noninteractive
4
 
5
  WORKDIR /app
6
 
7
- # 安装基础工具
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  ca-certificates \
10
  curl \
11
  wget \
12
  bash \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # 下载 llamafile 主程序
16
  RUN curl -L --fail \
17
- https://github.com/Mozilla-Ocho/llamafile/releases/download/0.9.2/llamafile-0.9.2 \
18
  -o /app/llamafile \
19
  && chmod +x /app/llamafile
20
 
21
- # 下载 GGUF 模型
22
- # 这个模型比较适合 HF 免费 CPU Space
23
  RUN curl -L --fail \
24
  https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct-GGUF/resolve/main/qwen2.5-1.5b-instruct-q8_0.gguf \
25
  -o /app/model.gguf
26
 
27
- # Hugging Face Space 默认网页端口
28
  EXPOSE 7860
29
 
30
- # 启动 llamafile Web Chat
31
- CMD ["/app/llamafile", \
32
- "-m", "/app/model.gguf", \
33
- "--server", \
34
- "--host", "0.0.0.0", \
35
- "--port", "7860", \
36
- "-ngl", "0", \
37
- "-t", "2", \
38
- "-c", "4096"]
 
4
 
5
  WORKDIR /app
6
 
7
+ # 安装基础工具(增加 zsh,因为某些版本的 Cosmopolitan 壳需要它或者 bash 强制解析)
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  ca-certificates \
10
  curl \
11
  wget \
12
  bash \
13
+ tini \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # 💡 核心修复点 1:下载官方特制、没有被 Cosmopolitan 混淆的纯 Linux-x86_64 专用二进制版
17
  RUN curl -L --fail \
18
+ https://github.com/Mozilla-Ocho/llamafile/releases/download/0.9.2/llamafile-0.9.2.linux-x86_64 \
19
  -o /app/llamafile \
20
  && chmod +x /app/llamafile
21
 
22
+ # 下载 GGUF 模型(保持你选的 1.5B 优质轻量模型)
 
23
  RUN curl -L --fail \
24
  https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct-GGUF/resolve/main/qwen2.5-1.5b-instruct-q8_0.gguf \
25
  -o /app/model.gguf
26
 
 
27
  EXPOSE 7860
28
 
29
+ ENTRYPOINT ["/usr/bin/tini", "--"]
30
+
31
+ # 💡 核心修复点 2:在 Linux Docker 中,最稳妥的启动方式是让 /bin/sh 或者是 /bin/bash 去拉起它,避免内核直接解析 header 失败
32
+ CMD ["/bin/sh", "-c", "/app/llamafile -m /app/model.gguf --server --host 0.0.0.0 --port 7860 -ngl 0 -t 2 -c 4096"]