From 7b6926bb38954b8f761672ef81cdd14fdf363889 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Tue, 11 Aug 2020 00:22:41 +0800 Subject: [PATCH] =?UTF-8?q?=E2=98=80=EF=B8=8F=20=E5=B0=9D=E8=AF=95?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20Docker=20=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile.persistant | 2 ++ utils/docker-run.sh | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile.persistant b/Dockerfile.persistant index 067af49..52ff81b 100644 --- a/Dockerfile.persistant +++ b/Dockerfile.persistant @@ -38,5 +38,7 @@ RUN git clone -b master https://github.com/xtaodada/PagerMaid-Modify.git /pagerm WORKDIR /pagermaid/workdir RUN python3 -m virtualenv venv RUN source venv/bin/activate; pip3 install -r requirements.txt +USER root +RUN cd /pagermaid/workdir CMD ["sh","utils/docker-run.sh"] diff --git a/utils/docker-run.sh b/utils/docker-run.sh index 67ad8ea..dffb660 100644 --- a/utils/docker-run.sh +++ b/utils/docker-run.sh @@ -82,13 +82,13 @@ login() { systemctl_reload(){ echo "正在写入系统进程守护 . . ." - sudo -i>> /dev/null 2>&1 echo "[Unit] Description=PagerMaid-Modify telegram utility daemon After=network.target [Install] WantedBy=multi-user.target [Service] + User=pagermaid Type=simple WorkingDirectory=/pagermaid/workdir ExecStart=/pagermaid/workdir/venv/bin/python -m pagermaid @@ -97,7 +97,6 @@ systemctl_reload(){ chmod 755 pagermaid.service >> /dev/null 2>&1 systemctl daemon-reload >> /dev/null 2>&1 systemctl enable pagermaid >> /dev/null 2>&1 - su pagermaid >> /dev/null 2>&1 echo "" echo "请在脚本退出后输入 exit 退出 Docker" echo ""