修改Docker容器用户为非root,避免文件权限问题(过渡版本)

This commit is contained in:
Sirly 2022-10-29 16:10:48 +00:00
parent 2f90294683
commit b3cc37bf32
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ services:
# image: swr.cn-south-1.myhuaweicloud.com/sirly/yunzai-bot:v3plus # 使用扩展镜像包含ffmpeg和python
# image: sirly/yunzai-bot:v3 # Docker Hub源
# image: sirly/yunzai-bot:v3plus
# user: "1000:1000" # 指定容器内用户,格式"UID:GID"(请先修改文件夹权限)
restart: always
# ports:
# - "50831:50831" # 映射锅巴插件端口,格式"主机端口:容器内部端口"
@ -23,6 +24,9 @@ services:
# - ./yunzai/plugins/xiaoyao-cvs-plugin:/app/Yunzai-Bot/plugins/xiaoyao-cvs-plugin # 图鉴插件
#### [警告] 受云崽架构和docker特性限制使用锅巴插件安装的插件无法持久化销毁容器后新安装的插件会消失请谨慎使用 ####
# - ./yunzai/plugins/Guoba-Plugin:/app/Yunzai-Bot/plugins/Guoba-Plugin # 锅巴插件
environment:
- CUID=1000 # 宿主机运行 id -u 获取
- CGID=1000 # 宿主机运行 id -g 获取
depends_on:
redis: { condition: service_healthy }
deploy:

View File

@ -19,6 +19,9 @@ if [[ ! -d "$HOME/.ovo" ]]; then
mkdir ~/.ovo
fi
chown -R ${CUID}:${CGID} $(WORK_DIR)
chmod -R 777 $(WORK_DIR)
echo -e "\n ================ \n ${Info} ${GreenBG} 拉取 Yunzai-Bot 更新 ${Font} \n ================ \n"
if [[ -z $(git status -s) ]]; then