Skip to content

Commit 269804f

Browse files
committed
update dockerfiles
1 parent 8042750 commit 269804f

File tree

6 files changed

+99
-97
lines changed

6 files changed

+99
-97
lines changed

.github/workflows/build-with-chatglm.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/Dockerfile+ChatGLM

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/Dockerfile+NoLocal+Latex

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/GithubAction+NoLocal

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
11
# 此Dockerfile适用于“无本地模型”的环境构建,如果需要使用chatglm等本地模型,请参考 docs/Dockerfile+ChatGLM
22
# 如何构建: 先修改 `config.py`, 然后 docker build -t gpt-academic-nolocal -f docs/Dockerfile+NoLocal .
33
# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal
4-
FROM python:3.11
4+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
55

6-
# 指定路径
7-
WORKDIR /gpt
6+
# 非必要步骤,更换pip源 (以下三行,可以删除)
7+
RUN echo '[global]' > /etc/pip.conf && \
8+
echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \
9+
echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf
810

9-
# 装载项目文件
10-
COPY . .
11+
# 语音输出功能(以下1,2行更换阿里源,第3,4行安装ffmpeg,都可以删除)
12+
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
13+
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
14+
apt-get update
15+
RUN apt-get install ffmpeg -y
16+
RUN apt-get clean
1117

12-
# 安装依赖
13-
RUN pip3 install -r requirements.txt
18+
# 进入工作路径(必要)
19+
WORKDIR /gpt
1420

15-
# edge-tts需要的依赖
16-
RUN apt update && apt install ffmpeg -y
21+
# 安装大部分依赖,利用Docker缓存加速以后的构建 (以下两行,可以删除)
22+
COPY requirements.txt ./
23+
RUN uv venv --python=3.12 && uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
24+
ENV PATH="/gpt/.venv/bin:$PATH"
25+
RUN python -c 'import loguru'
26+
27+
# 装载项目文件,安装剩余依赖(必要)
28+
COPY . .
29+
RUN uv venv --python=3.12 && uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
1730

18-
# 可选步骤,用于预热模块
19-
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'
31+
# # 非必要步骤,用于预热模块(可以删除)
32+
RUN python -c 'from check_proxy import warm_up_modules; warm_up_modules()'
2033

21-
RUN python3 -m pip cache purge && apt-get clean
34+
ENV CGO_ENABLED=0
2235

23-
# 启动
24-
CMD ["python3", "-u", "main.py"]
36+
# 启动(必要)
37+
CMD ["bash", "-c", "python main.py"]
Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,44 @@
1-
# 此Dockerfile适用于“无本地模型”的环境构建,如果需要使用chatglm等本地模型,请参考 docs/Dockerfile+ChatGLM
2-
# 如何构建: 先修改 `config.py`, 然后 docker build -t gpt-academic-nolocal -f docs/Dockerfile+NoLocal .
3-
# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal
4-
FROM python:3.11
1+
# 此Dockerfile适用于“无本地模型”的迷你运行环境构建
2+
# 如果需要使用chatglm等本地模型或者latex运行依赖,请参考 docker-compose.yml
3+
# - 如何构建: 先修改 `config.py`, 然后 `docker build -t gpt-academic . `
4+
# - 如何运行(Linux下): `docker run --rm -it --net=host gpt-academic `
5+
# - 如何运行(其他操作系统,选择任意一个固定端口50923): `docker run --rm -it -e WEB_PORT=50923 -p 50923:50923 gpt-academic `
56

6-
# 指定路径
7+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
8+
9+
# 非必要步骤,更换pip源 (以下三行,可以删除)
10+
RUN echo '[global]' > /etc/pip.conf && \
11+
echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \
12+
echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf
13+
14+
# 语音输出功能(以下1,2行更换阿里源,第3,4行安装ffmpeg,都可以删除)
15+
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
16+
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
17+
apt-get update
18+
RUN apt-get install ffmpeg -y
19+
RUN apt-get clean
20+
21+
# 进入工作路径(必要)
722
WORKDIR /gpt
823

9-
# 装载项目文件
10-
COPY . .
24+
# 安装大部分依赖,利用Docker缓存加速以后的构建 (以下两行,可以删除)
25+
COPY requirements.txt ./
26+
RUN uv venv --python=3.12 && uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
27+
RUN uv venv --python=3.12 && uv pip install aliyun-python-sdk-core==2.13.3 pyOpenSSL webrtcvad scipy git+https://github.com/aliyun/alibabacloud-nls-python-sdk.git
28+
ENV PATH="/gpt/.venv/bin:$PATH"
29+
RUN python -c 'import loguru'
1130

12-
# 安装依赖
13-
RUN pip3 install -r requirements.txt
31+
# 装载项目文件,安装剩余依赖(必要)
32+
COPY . .
33+
RUN uv venv --python=3.12 && uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
1434

15-
# 安装语音插件的额外依赖
16-
RUN pip3 install aliyun-python-sdk-core==2.13.3 pyOpenSSL webrtcvad scipy git+https://github.com/aliyun/alibabacloud-nls-python-sdk.git
35+
# # 非必要步骤,用于预热模块(可以删除)
36+
RUN python -c 'from check_proxy import warm_up_modules; warm_up_modules()'
1737

18-
# edge-tts需要的依赖
19-
RUN apt update && apt install ffmpeg -y
38+
ENV CGO_ENABLED=0
2039

21-
# 可选步骤,用于预热模块
22-
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'
40+
# 启动(必要)
41+
CMD ["bash", "-c", "python main.py"]
2342

2443
# 启动
2544
CMD ["python3", "-u", "main.py"]

docs/GithubAction+NoLocal+Vectordb

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
1-
# 此Dockerfile适用于“无本地模型”的环境构建,如果需要使用chatglm等本地模型,请参考 docs/Dockerfile+ChatGLM
2-
# 如何构建: 先修改 `config.py`, 然后 docker build -t gpt-academic-nolocal-vs -f docs/GithubAction+NoLocal+Vectordb .
3-
# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal-vs
4-
FROM python:3.11
5-
6-
# 指定路径
1+
# 此Dockerfile适用于“无本地模型”的迷你运行环境构建
2+
# 如果需要使用chatglm等本地模型或者latex运行依赖,请参考 docker-compose.yml
3+
# - 如何构建: 先修改 `config.py`, 然后 `docker build -t gpt-academic . `
4+
# - 如何运行(Linux下): `docker run --rm -it --net=host gpt-academic `
5+
# - 如何运行(其他操作系统,选择任意一个固定端口50923): `docker run --rm -it -e WEB_PORT=50923 -p 50923:50923 gpt-academic `
6+
7+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
8+
9+
# 非必要步骤,更换pip源 (以下三行,可以删除)
10+
RUN echo '[global]' > /etc/pip.conf && \
11+
echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \
12+
echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf
13+
14+
# 语音输出功能(以下1,2行更换阿里源,第3,4行安装ffmpeg,都可以删除)
15+
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
16+
sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \
17+
apt-get update
18+
RUN apt-get install ffmpeg -y
19+
RUN apt-get clean
20+
21+
# 进入工作路径(必要)
722
WORKDIR /gpt
823

9-
# 装载项目文件
24+
# 安装大部分依赖,利用Docker缓存加速以后的构建 (以下两行,可以删除)
25+
COPY requirements.txt ./
26+
RUN uv venv --python=3.12 && uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
27+
RUN uv venv --python=3.12 && uv pip install aliyun-python-sdk-core==2.13.3 pyOpenSSL webrtcvad scipy git+https://github.com/aliyun/alibabacloud-nls-python-sdk.git
28+
RUN uv venv --python=3.12 && uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
29+
RUN uv venv --python=3.12 && uv pip install transformers protobuf langchain sentence-transformers faiss-cpu nltk beautifulsoup4 bitsandbytes tabulate icetk --upgrade
30+
RUN uv venv --python=3.12 && uv pip install unstructured[all-docs] --upgrade
31+
ENV PATH="/gpt/.venv/bin:$PATH"
32+
RUN python -c 'import loguru'
33+
34+
# 装载项目文件,安装剩余依赖(必要)
1035
COPY . .
36+
RUN uv venv --python=3.12 && uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
1137

12-
# 安装依赖
13-
RUN pip3 install -r requirements.txt
14-
15-
# 安装知识库插件的额外依赖
16-
RUN apt-get update && apt-get install libgl1 -y
17-
RUN pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu
18-
RUN pip3 install transformers protobuf langchain sentence-transformers faiss-cpu nltk beautifulsoup4 bitsandbytes tabulate icetk --upgrade
19-
RUN pip3 install unstructured[all-docs] --upgrade
20-
RUN python3 -c 'from check_proxy import warm_up_vectordb; warm_up_vectordb()'
21-
22-
# edge-tts需要的依赖
23-
RUN apt update && apt install ffmpeg -y
38+
# # 非必要步骤,用于预热模块(可以删除)
39+
RUN python -c 'from check_proxy import warm_up_modules; warm_up_modules()'
2440

25-
# 可选步骤,用于预热模块
26-
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'
27-
RUN python3 -m pip cache purge && apt-get clean
41+
ENV CGO_ENABLED=0
2842

43+
# 启动(必要)
44+
CMD ["bash", "-c", "python main.py"]
2945

3046
# 启动
3147
CMD ["python3", "-u", "main.py"]

0 commit comments

Comments
 (0)