diff --git a/.github/workflows/build-with-chatglm.yml b/.github/workflows/build-with-chatglm.yml deleted file mode 100644 index f729abb0..00000000 --- a/.github/workflows/build-with-chatglm.yml +++ /dev/null @@ -1,44 +0,0 @@ -# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages -name: build-with-chatglm - -on: - push: - branches: - - 'master' - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }}_chatglm_moss - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - uses: docker/build-push-action@v4 - with: - context: . - push: true - file: docs/GithubAction+ChatGLM+Moss - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/docs/Dockerfile+ChatGLM b/docs/Dockerfile+ChatGLM deleted file mode 100644 index 7777bf26..00000000 --- a/docs/Dockerfile+ChatGLM +++ /dev/null @@ -1 +0,0 @@ -# 此Dockerfile不再维护,请前往docs/GithubAction+ChatGLM+Moss diff --git a/docs/Dockerfile+NoLocal+Latex b/docs/Dockerfile+NoLocal+Latex deleted file mode 100644 index a0f162af..00000000 --- a/docs/Dockerfile+NoLocal+Latex +++ /dev/null @@ -1 +0,0 @@ -# 此Dockerfile不再维护,请前往docs/GithubAction+NoLocal+Latex diff --git a/docs/GithubAction+NoLocal b/docs/GithubAction+NoLocal index 07553a2d..59bd37c8 100644 --- a/docs/GithubAction+NoLocal +++ b/docs/GithubAction+NoLocal @@ -1,24 +1,37 @@ # 此Dockerfile适用于“无本地模型”的环境构建,如果需要使用chatglm等本地模型,请参考 docs/Dockerfile+ChatGLM # 如何构建: 先修改 `config.py`, 然后 docker build -t gpt-academic-nolocal -f docs/Dockerfile+NoLocal . # 如何运行: docker run --rm -it --net=host gpt-academic-nolocal -FROM python:3.11 +FROM ghcr.io/astral-sh/uv:python3.12-bookworm -# 指定路径 +# 非必要步骤,更换pip源 (以下三行,可以删除) +RUN echo '[global]' > /etc/pip.conf && \ + echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \ + echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf + +# 语音输出功能(以下1,2行更换阿里源,第3,4行安装ffmpeg,都可以删除) +RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ + sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ + apt-get update +RUN apt-get install ffmpeg -y +RUN apt-get clean + +# 进入工作路径(必要) WORKDIR /gpt -# 装载项目文件 +# 安装大部分依赖,利用Docker缓存加速以后的构建 (以下两行,可以删除) +COPY requirements.txt ./ +RUN uv venv --python=3.12 && uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ +ENV PATH="/gpt/.venv/bin:$PATH" +RUN python -c 'import loguru' + +# 装载项目文件,安装剩余依赖(必要) COPY . . +RUN uv venv --python=3.12 && uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ -# 安装依赖 -RUN pip3 install -r requirements.txt +# # 非必要步骤,用于预热模块(可以删除) +RUN python -c 'from check_proxy import warm_up_modules; warm_up_modules()' -# edge-tts需要的依赖 -RUN apt update && apt install ffmpeg -y +ENV CGO_ENABLED=0 -# 可选步骤,用于预热模块 -RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()' - -RUN python3 -m pip cache purge && apt-get clean - -# 启动 -CMD ["python3", "-u", "main.py"] +# 启动(必要) +CMD ["bash", "-c", "python main.py"] \ No newline at end of file diff --git a/docs/GithubAction+NoLocal+AudioAssistant b/docs/GithubAction+NoLocal+AudioAssistant index 17e2ed70..80b25d93 100644 --- a/docs/GithubAction+NoLocal+AudioAssistant +++ b/docs/GithubAction+NoLocal+AudioAssistant @@ -1,25 +1,44 @@ -# 此Dockerfile适用于“无本地模型”的环境构建,如果需要使用chatglm等本地模型,请参考 docs/Dockerfile+ChatGLM -# 如何构建: 先修改 `config.py`, 然后 docker build -t gpt-academic-nolocal -f docs/Dockerfile+NoLocal . -# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal -FROM python:3.11 +# 此Dockerfile适用于“无本地模型”的迷你运行环境构建 +# 如果需要使用chatglm等本地模型或者latex运行依赖,请参考 docker-compose.yml +# - 如何构建: 先修改 `config.py`, 然后 `docker build -t gpt-academic . ` +# - 如何运行(Linux下): `docker run --rm -it --net=host gpt-academic ` +# - 如何运行(其他操作系统,选择任意一个固定端口50923): `docker run --rm -it -e WEB_PORT=50923 -p 50923:50923 gpt-academic ` -# 指定路径 +FROM ghcr.io/astral-sh/uv:python3.12-bookworm + +# 非必要步骤,更换pip源 (以下三行,可以删除) +RUN echo '[global]' > /etc/pip.conf && \ + echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \ + echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf + +# 语音输出功能(以下1,2行更换阿里源,第3,4行安装ffmpeg,都可以删除) +RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ + sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ + apt-get update +RUN apt-get install ffmpeg -y +RUN apt-get clean + +# 进入工作路径(必要) WORKDIR /gpt -# 装载项目文件 +# 安装大部分依赖,利用Docker缓存加速以后的构建 (以下两行,可以删除) +COPY requirements.txt ./ +RUN uv venv --python=3.12 && uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ +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 +ENV PATH="/gpt/.venv/bin:$PATH" +RUN python -c 'import loguru' + +# 装载项目文件,安装剩余依赖(必要) COPY . . +RUN uv venv --python=3.12 && uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ -# 安装依赖 -RUN pip3 install -r requirements.txt +# # 非必要步骤,用于预热模块(可以删除) +RUN python -c 'from check_proxy import warm_up_modules; warm_up_modules()' -# 安装语音插件的额外依赖 -RUN pip3 install aliyun-python-sdk-core==2.13.3 pyOpenSSL webrtcvad scipy git+https://github.com/aliyun/alibabacloud-nls-python-sdk.git +ENV CGO_ENABLED=0 -# edge-tts需要的依赖 -RUN apt update && apt install ffmpeg -y - -# 可选步骤,用于预热模块 -RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()' +# 启动(必要) +CMD ["bash", "-c", "python main.py"] # 启动 CMD ["python3", "-u", "main.py"] diff --git a/docs/GithubAction+NoLocal+Vectordb b/docs/GithubAction+NoLocal+Vectordb index ba897f9b..fad012b1 100644 --- a/docs/GithubAction+NoLocal+Vectordb +++ b/docs/GithubAction+NoLocal+Vectordb @@ -1,31 +1,47 @@ -# 此Dockerfile适用于“无本地模型”的环境构建,如果需要使用chatglm等本地模型,请参考 docs/Dockerfile+ChatGLM -# 如何构建: 先修改 `config.py`, 然后 docker build -t gpt-academic-nolocal-vs -f docs/GithubAction+NoLocal+Vectordb . -# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal-vs -FROM python:3.11 +# 此Dockerfile适用于“无本地模型”的迷你运行环境构建 +# 如果需要使用chatglm等本地模型或者latex运行依赖,请参考 docker-compose.yml +# - 如何构建: 先修改 `config.py`, 然后 `docker build -t gpt-academic . ` +# - 如何运行(Linux下): `docker run --rm -it --net=host gpt-academic ` +# - 如何运行(其他操作系统,选择任意一个固定端口50923): `docker run --rm -it -e WEB_PORT=50923 -p 50923:50923 gpt-academic ` -# 指定路径 +FROM ghcr.io/astral-sh/uv:python3.12-bookworm + +# 非必要步骤,更换pip源 (以下三行,可以删除) +RUN echo '[global]' > /etc/pip.conf && \ + echo 'index-url = https://mirrors.aliyun.com/pypi/simple/' >> /etc/pip.conf && \ + echo 'trusted-host = mirrors.aliyun.com' >> /etc/pip.conf + +# 语音输出功能(以下1,2行更换阿里源,第3,4行安装ffmpeg,都可以删除) +RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ + sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources && \ + apt-get update +RUN apt-get install ffmpeg -y +RUN apt-get clean + +# 进入工作路径(必要) WORKDIR /gpt -# 装载项目文件 +# 安装大部分依赖,利用Docker缓存加速以后的构建 (以下两行,可以删除) +COPY requirements.txt ./ +RUN uv venv --python=3.12 && uv pip install --verbose -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ +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 +RUN uv venv --python=3.12 && uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu +RUN uv venv --python=3.12 && uv pip install transformers protobuf langchain sentence-transformers faiss-cpu nltk beautifulsoup4 bitsandbytes tabulate icetk --upgrade +RUN uv venv --python=3.12 && uv pip install unstructured[all-docs] --upgrade +ENV PATH="/gpt/.venv/bin:$PATH" +RUN python -c 'import loguru' + +# 装载项目文件,安装剩余依赖(必要) COPY . . +RUN uv venv --python=3.12 && uv pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ -# 安装依赖 -RUN pip3 install -r requirements.txt +# # 非必要步骤,用于预热模块(可以删除) +RUN python -c 'from check_proxy import warm_up_modules; warm_up_modules()' -# 安装知识库插件的额外依赖 -RUN apt-get update && apt-get install libgl1 -y -RUN pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu -RUN pip3 install transformers protobuf langchain sentence-transformers faiss-cpu nltk beautifulsoup4 bitsandbytes tabulate icetk --upgrade -RUN pip3 install unstructured[all-docs] --upgrade -RUN python3 -c 'from check_proxy import warm_up_vectordb; warm_up_vectordb()' - -# edge-tts需要的依赖 -RUN apt update && apt install ffmpeg -y - -# 可选步骤,用于预热模块 -RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()' -RUN python3 -m pip cache purge && apt-get clean +ENV CGO_ENABLED=0 +# 启动(必要) +CMD ["bash", "-c", "python main.py"] # 启动 CMD ["python3", "-u", "main.py"]