huanbao commited on
Commit
c025edb
·
verified ·
1 Parent(s): b5ee164

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -9
Dockerfile CHANGED
@@ -2,24 +2,22 @@ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
- # 1. 安装 git 和 git-lfs (下载模型需要)
6
  RUN apt-get update && apt-get install -y git git-lfs
7
 
8
- # 2. 复制依赖并安装
9
  COPY requirements.txt .
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
- # 3. 核心步骤:直接在服务器端下载模型到 /app/models 目录
13
- # 使用 HF 镜像站加速(虽然在HF内部不需要,但加上保险)
14
- # 只下载 safetensors 等核心文件,排除大文件避免镜像过大(如果需要)
15
  RUN pip install huggingface_hub
16
- RUN huggingface-cli download --resume-download BAAI/bge-m3 --local-dir /app/models/bge-m3
17
- RUN huggingface-cli download --resume-download BAAI/bge-reranker-base --local-dir /app/models/bge-reranker
18
 
19
- # 4. 复制其余代码
 
 
 
 
 
20
  COPY . .
21
 
22
- # 5. 设置权限和环境变量
23
  RUN mkdir -p /app/cache && chmod 777 /app/cache
24
  ENV HF_HOME=/app/cache
25
 
 
2
 
3
  WORKDIR /app
4
 
 
5
  RUN apt-get update && apt-get install -y git git-lfs
6
 
 
7
  COPY requirements.txt .
8
  RUN pip install --no-cache-dir -r requirements.txt
9
 
10
+ # --- 混合下载配置 ---
 
 
11
  RUN pip install huggingface_hub
 
 
12
 
13
+ # 1. Embedding 用大模型 M3 (只下 safetensors)
14
+ RUN huggingface-cli download --resume-download BAAI/bge-m3 --local-dir /app/models/bge-m3 --exclude "*.bin"
15
+
16
+ # 2. Rerank 必须用 Base 小模型 (否则超时)
17
+ RUN huggingface-cli download --resume-download BAAI/bge-reranker-base --local-dir /app/models/bge-reranker --exclude "*.bin"
18
+
19
  COPY . .
20
 
 
21
  RUN mkdir -p /app/cache && chmod 777 /app/cache
22
  ENV HF_HOME=/app/cache
23