yetey commited on
Commit
e572b72
1 Parent(s): 0c4309a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -18
Dockerfile CHANGED
@@ -1,23 +1,40 @@
1
- FROM python:3.11
2
- RUN pip install --upgrade pip
3
- RUN apt-get update && apt-get install -y git
 
 
 
 
 
 
4
  RUN git clone https://github.com/binary-husky/gpt_academic
 
 
5
  WORKDIR /gpt_academic
6
- RUN mkdir /.cache && chmod 777 /.cache
7
- RUN mkdir /gpt_academic/gpt_log && chmod 777 /gpt_academic/gpt_log
8
- RUN mkdir /gpt_academic/private_upload && chmod 777 /gpt_academic/private_upload
9
- RUN pip install -r requirements.txt
10
- RUN pip install --upgrade nougat-ocr tiktoken
11
- ENV MPLCONFIGDIR=/gpt_academic/.matplotlib
12
- RUN mkdir $MPLCONFIGDIR && chmod 777 $MPLCONFIGDIR
13
-
14
- ENV WEB_PORT=7860
15
- ENV DEFAULT_WORKER_NUM=3
16
- ENV THEME="Chuanhu-Small-and-Beautiful"
17
- ENV DARK_MODE=False
18
- ENV TIMEOUT_SECONDS=10
19
- ENV MAX_RETRY=3
20
- ENV LLM_MODEL="gpt-3.5-turbo"
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  EXPOSE 7860
 
 
23
  CMD ["python3", "-u", "main.py"]
 
1
+ # 使用更具体的基础镜像标签,例如 python:3.11-slim,可以减小镜像大小。
2
+ FROM python:3.11-slim
3
+
4
+ # 更新 pip 并安装依赖项。
5
+ RUN apt-get update \
6
+ && apt-get install -y --no-install-recommends git \
7
+ && pip install --no-cache-dir --upgrade pip
8
+
9
+ # 克隆项目仓库。
10
  RUN git clone https://github.com/binary-husky/gpt_academic
11
+
12
+ # 设置工作目录。
13
  WORKDIR /gpt_academic
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
+ # 创建所需目录并设置权限。
16
+ RUN mkdir -p /.cache /gpt_academic/gpt_log /gpt_academic/private_upload \
17
+ && chmod 777 /.cache /gpt_academic/gpt_log /gpt_academic/private_upload
18
+
19
+ # 安装 Python 依赖。
20
+ RUN pip install -r requirements.txt \
21
+ && pip install --upgrade nougat-ocr tiktoken
22
+
23
+ # 设置环境变量。
24
+ ENV MPLCONFIGDIR=/gpt_academic/.matplotlib \
25
+ WEB_PORT=7860 \
26
+ DEFAULT_WORKER_NUM=3 \
27
+ THEME="Chuanhu-Small-and-Beautiful" \
28
+ DARK_MODE=False \
29
+ TIMEOUT_SECONDS=10 \
30
+ MAX_RETRY=3 \
31
+ LLM_MODEL="gpt-3.5-turbo"
32
+
33
+ # 创建 matplotlib 配置目录。
34
+ RUN mkdir -p $MPLCONFIGDIR && chmod 777 $MPLCONFIGDIR
35
+
36
+ # 暴露端口。
37
  EXPOSE 7860
38
+
39
+ # 设置容器启动命令。
40
  CMD ["python3", "-u", "main.py"]