Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

临时参考方案:为Dockerfile增加用户管理,避免镜像以root用户运行 #1273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/GithubAction+AllCapacity
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# 从NVIDIA源,从而支持显卡(检查宿主的nvidia-smi中的cuda版本必须>=11.3)
FROM fuqingxu/11.3.1-runtime-ubuntu20.04-with-texlive:latest

# 创建非root用户
RUN useradd -ms /bin/bash gpt_academic

# use python3 as the system default python
WORKDIR /gpt
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.8
Expand Down Expand Up @@ -32,5 +35,8 @@ RUN python3 -m pip install nougat-ocr
# 预热Tiktoken模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'

# 切换到非root用户
USER gpt_academic

# 启动
CMD ["python3", "-u", "main.py"]
7 changes: 7 additions & 0 deletions docs/GithubAction+ChatGLM+Moss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# 从NVIDIA源,从而支持显卡运损(检查宿主的nvidia-smi中的cuda版本必须>=11.3)
FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04

# 创建非root用户
RUN useradd -ms /bin/bash gpt_academic

RUN apt-get update
RUN apt-get install -y curl proxychains curl gcc
RUN apt-get install -y git python python3 python-dev python3-dev --fix-missing
Expand All @@ -26,5 +30,8 @@ RUN python3 -m pip install -r request_llms/requirements_newbing.txt
# 预热Tiktoken模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'

# 切换到非root用户
USER gpt_academic

# 启动
CMD ["python3", "-u", "main.py"]
7 changes: 7 additions & 0 deletions docs/GithubAction+JittorLLMs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# 从NVIDIA源,从而支持显卡运损(检查宿主的nvidia-smi中的cuda版本必须>=11.3)
FROM nvidia/cuda:11.3.1-runtime-ubuntu20.04
ARG useProxyNetwork=''

# 创建非root用户
RUN useradd -ms /bin/bash gpt_academic

RUN apt-get update
RUN apt-get install -y curl proxychains curl g++
RUN apt-get install -y git python python3 python-dev python3-dev --fix-missing
Expand Down Expand Up @@ -30,5 +34,8 @@ RUN git pull
# 预热Tiktoken模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'

# 切换到非root用户
USER gpt_academic

# 启动
CMD ["python3", "-u", "main.py"]
6 changes: 6 additions & 0 deletions docs/GithubAction+NoLocal
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal
FROM python:3.11

# 创建非root用户
RUN useradd -ms /bin/bash gpt_academic

# 指定路径
WORKDIR /gpt

Expand All @@ -16,5 +19,8 @@ RUN pip3 install -r requirements.txt
# 可选步骤,用于预热模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'

# 切换到非root用户
USER gpt_academic

# 启动
CMD ["python3", "-u", "main.py"]
6 changes: 6 additions & 0 deletions docs/GithubAction+NoLocal+AudioAssistant
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# 如何运行: docker run --rm -it --net=host gpt-academic-nolocal
FROM python:3.11

# 创建非root用户
RUN useradd -ms /bin/bash gpt_academic

# 指定路径
WORKDIR /gpt

Expand All @@ -18,5 +21,8 @@ RUN pip3 install pyOpenSSL scipy git+https://github.com/aliyun/alibabacloud-nls-
# 可选步骤,用于预热模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'

# 切换到非root用户
USER gpt_academic

# 启动
CMD ["python3", "-u", "main.py"]
6 changes: 6 additions & 0 deletions docs/GithubAction+NoLocal+Latex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ ENV PATH "$PATH:/usr/local/texlive/2024/bin/x86_64-linux"
ENV PATH "$PATH:/usr/local/texlive/2025/bin/x86_64-linux"
ENV PATH "$PATH:/usr/local/texlive/2026/bin/x86_64-linux"

# 创建非root用户
RUN useradd -ms /bin/bash gpt_academic

# 指定路径
WORKDIR /gpt

Expand All @@ -28,5 +31,8 @@ RUN pip3 install -r requirements.txt
# 可选步骤,用于预热模块
RUN python3 -c 'from check_proxy import warm_up_modules; warm_up_modules()'

# 切换到非root用户
USER gpt_academic

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