javaeeduke commited on
Commit
59f7b7d
·
verified ·
1 Parent(s): a75f40b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -19
Dockerfile CHANGED
@@ -1,32 +1,30 @@
1
- FROM ubuntu:22.04
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
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"]
 
 
 
 
 
 
 
1
+ # 💡 直接使用 llama.cpp 官方构建好的纯 Linux-amd64 运行环境镜像
2
+ FROM ghcr.io/ggerganov/llama.cpp:server
 
3
 
4
  WORKDIR /app
5
 
6
+ # 安装 curl 用来下载模型
7
+ USER root
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
9
  curl \
10
+ ca-certificates \
 
 
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # 下载你的 Qwen 2.5 1.5B 优质轻量模型
 
 
 
 
 
 
14
  RUN curl -L --fail \
15
  https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct-GGUF/resolve/main/qwen2.5-1.5b-instruct-q8_0.gguf \
16
  -o /app/model.gguf
17
 
18
+ # 暴露 Hugging Face 规定的 7860 端口
19
  EXPOSE 7860
20
 
21
+ # 启动 llama.cpp 自带的满血版聊天 Web 界面
22
+ # --host 0.0.0.0 和 --port 7860 是为了让外网(你的浏览器)可以访问
23
+ # -t 2 限制为免费层2CPU 线程数
24
+ CMD ["/llama-server", \
25
+ "-m", "/app/model.gguf", \
26
+ "--host", "0.0.0.0", \
27
+ "--port", "7860", \
28
+ "-ngl", "0", \
29
+ "-t", "2", \
30
+ "-c", "4096"]