Hanxiaofeng123 commited on
Commit
c774086
·
verified ·
1 Parent(s): 0218d71

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -1
Dockerfile CHANGED
@@ -8,13 +8,21 @@ RUN apt-get update && apt-get install -y \
8
  # 安装 PyTorch
9
  RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu
10
 
11
- # 安装其他依赖和huggingface-hub
12
  COPY requirements.txt .
13
  RUN pip install -r requirements.txt huggingface-hub
14
 
 
 
 
15
  # 拷贝代码
16
  COPY . /app
17
  WORKDIR /app
18
 
 
 
 
 
 
19
  # 入口
20
  CMD ["python", "app.py"]
 
8
  # 安装 PyTorch
9
  RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu
10
 
11
+ # 安装其他依赖
12
  COPY requirements.txt .
13
  RUN pip install -r requirements.txt huggingface-hub
14
 
15
+ # 创建有写入权限的缓存目录
16
+ RUN mkdir -p /hf_cache && chmod 777 /hf_cache
17
+
18
  # 拷贝代码
19
  COPY . /app
20
  WORKDIR /app
21
 
22
+ # 设置环境变量
23
+ ENV HF_HOME=/hf_cache
24
+ ENV TRANSFORMERS_CACHE=/hf_cache
25
+ ENV HUGGINGFACE_HUB_CACHE=/hf_cache
26
+
27
  # 入口
28
  CMD ["python", "app.py"]