simler commited on
Commit
3aa5d4f
·
verified ·
1 Parent(s): 5f1c536

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -4
Dockerfile CHANGED
@@ -1,12 +1,12 @@
1
  FROM python:3.10-slim
2
 
3
- # 安装必备的系统组件
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
5
  curl \
6
  libgomp1 \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- # 创建非 root 用户
10
  RUN useradd -m -u 1000 user
11
  USER user
12
  ENV HOME=/home/user \
@@ -16,8 +16,11 @@ WORKDIR $HOME/app
16
 
17
  COPY --chown=user requirements.txt .
18
 
19
- # 🌟 核心魔法从官方的 CPU 专用仓库极速秒拉取“最新版本”
20
- RUN pip install --no-cache-dir -r requirements.txt --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
 
 
 
21
 
22
  COPY --chown=user app.py .
23
 
 
1
  FROM python:3.10-slim
2
 
3
+ # 1. 终极完全体:把 gcc 编译器 (build-essential) 和 多核库 (libgomp1) 全部带上!
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ build-essential \
6
  curl \
7
  libgomp1 \
8
  && rm -rf /var/lib/apt/lists/*
9
 
 
10
  RUN useradd -m -u 1000 user
11
  USER user
12
  ENV HOME=/home/user \
 
16
 
17
  COPY --chown=user requirements.txt .
18
 
19
+ # 2. 🌟 绝对防御强行限制编译线程数为 2!就算它自己编译也绝对不会再爆内存
20
+ ENV CMAKE_BUILD_PARALLEL_LEVEL=2
21
+
22
+ # 3. 卸下伪装,直接从官方拉取最新源码进行安全编译
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
 
25
  COPY --chown=user app.py .
26