leonsimon23 commited on
Commit
4cd3f9c
·
verified ·
1 Parent(s): 7be085c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -2
Dockerfile CHANGED
@@ -1,16 +1,29 @@
1
  FROM python:3.12
2
 
 
 
 
3
  WORKDIR /app
4
 
5
  COPY . .
6
 
7
- ENV PYTHONUNBUFFERED=1
 
8
 
 
9
  RUN apt-get update && apt-get install -y libgl1
10
 
 
 
 
 
11
  RUN pip install .
12
 
13
- # 指定要公开的端口
 
 
14
  EXPOSE 7860
15
 
 
 
16
  CMD ["pdf2zh", "-i"]
 
1
  FROM python:3.12
2
 
3
+ # 创建一个非根用户
4
+ RUN useradd -m appuser
5
+
6
  WORKDIR /app
7
 
8
  COPY . .
9
 
10
+ # 更改工作目录的所有者为新用户
11
+ RUN chown -R appuser:appuser /app
12
 
13
+ # 安装必要的库
14
  RUN apt-get update && apt-get install -y libgl1
15
 
16
+ # 设置 Hugging Face 缓存目录
17
+ ENV HF_HOME="/app/hf_cache"
18
+
19
+ # 安装 Python 包
20
  RUN pip install .
21
 
22
+ # 切换到非根用户
23
+ USER appuser
24
+
25
  EXPOSE 7860
26
 
27
+ ENV PYTHONUNBUFFERED=1
28
+
29
  CMD ["pdf2zh", "-i"]