File size: 1,152 Bytes
e572b72
 
 
 
 
 
 
 
 
c94c0c3
e572b72
 
2141774
 
e572b72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2141774
e572b72
 
2141774
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 使用更具体的基础镜像标签,例如 python:3.11-slim,可以减小镜像大小。
FROM python:3.11-slim

# 更新 pip 并安装依赖项。
RUN apt-get update \
    && apt-get install -y --no-install-recommends git \
    && pip install --no-cache-dir --upgrade pip

# 克隆项目仓库。
RUN git clone https://github.com/binary-husky/gpt_academic

# 设置工作目录。
WORKDIR /gpt_academic

# 创建所需目录并设置权限。
RUN mkdir -p /.cache /gpt_academic/gpt_log /gpt_academic/private_upload \
    && chmod 777 /.cache /gpt_academic/gpt_log /gpt_academic/private_upload

# 安装 Python 依赖。
RUN pip install -r requirements.txt \
    && pip install --upgrade nougat-ocr tiktoken

# 设置环境变量。
ENV MPLCONFIGDIR=/gpt_academic/.matplotlib \
    WEB_PORT=7860 \
    DEFAULT_WORKER_NUM=3 \
    THEME="Chuanhu-Small-and-Beautiful" \
    DARK_MODE=False \
    TIMEOUT_SECONDS=10 \
    MAX_RETRY=3 \
    LLM_MODEL="gpt-3.5-turbo"

# 创建 matplotlib 配置目录。
RUN mkdir -p $MPLCONFIGDIR && chmod 777 $MPLCONFIGDIR

# 暴露端口。
EXPOSE 7860

# 设置容器启动命令。
CMD ["python3", "-u", "main.py"]