Forrest99 commited on
Commit
8523cd0
·
verified ·
1 Parent(s): 6e56713

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -4
Dockerfile CHANGED
@@ -1,18 +1,21 @@
1
  FROM python:3.10-slim
2
 
3
- # 显式声明环境变量(与huggingface配置同步)
4
  ENV TRANSFORMERS_CACHE=/model-cache \
5
  PYTHONUNBUFFERED=1
6
 
7
- # 创建缓存目录
8
  RUN mkdir -p /model-cache && chmod 777 /model-cache
9
 
10
- # 安装依赖
11
- RUN apt-get update && apt-get install -y gcc python3-dev
12
 
 
13
  WORKDIR /app
14
  COPY . .
15
 
 
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
 
18
  CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 设置缓存路径(与网页配置一致)
4
  ENV TRANSFORMERS_CACHE=/model-cache \
5
  PYTHONUNBUFFERED=1
6
 
7
+ # 创建缓存目录(所有用户可写)
8
  RUN mkdir -p /model-cache && chmod 777 /model-cache
9
 
10
+ # 安装系统依赖
11
+ RUN apt-get update && apt-get install -y --no-install-recommends gcc python3-dev
12
 
13
+ # 复制代码
14
  WORKDIR /app
15
  COPY . .
16
 
17
+ # 安装Python依赖(全局安装)
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # 直接使用 root 用户运行(避免权限问题)
21
  CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]