From b264c91846a9745d22f93026540bbef787123603 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 21 Mar 2021 19:34:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=B7=BB=E5=8A=A0rebuild?= =?UTF-8?q?=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/Dockerfile | 4 ++-- sample/auth.json | 2 +- sample/crontab.list.sample | 2 ++ shell/rebuild.sh | 26 ++++++++++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 shell/rebuild.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index 9d24648b..286c28e3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -41,13 +41,13 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && ln -sf ${JD_DIR}/shell/export_sharecodes.sh /usr/local/bin/export_sharecodes \ && ln -sf ${JD_DIR}/shell/git_diy.sh /usr/local/bin/diy \ && ln -sf ${JD_DIR}/shell/notify.sh /usr/local/bin/notify \ + && ln -sf ${JD_DIR}/shell/rebuild.sh /usr/local/bin/rebuild \ && yarn install \ && yarn build \ && yarn build-back \ - && yarn install --production \ && git clone -b ${JD_SCRIPTS_BRANCH} ${JD_SCRIPTS_URL} ${JD_DIR}/scripts \ && cd ${JD_DIR}/scripts \ - && npm install --production\ + && npm install \ && npm install -g pm2 \ && rm -rf /root/.npm WORKDIR ${JD_DIR} diff --git a/sample/auth.json b/sample/auth.json index 65540d07..57cfabbe 100755 --- a/sample/auth.json +++ b/sample/auth.json @@ -1 +1 @@ -{"user":"admin","password":"adminadmin"} \ No newline at end of file +{ "username": "admin", "password": "adminadmin" } diff --git a/sample/crontab.list.sample b/sample/crontab.list.sample index 5a46cd4b..452b1924 100644 --- a/sample/crontab.list.sample +++ b/sample/crontab.list.sample @@ -1,6 +1,8 @@ # 更新你需要的仓库的代码 55 2,13 * * * bash git_pull >> ${JD_DIR}/log/git_pull.log 2>&1 30 * * * * bash diy i-chenzhe qx >> ${JD_DIR}/log/diy_pull.log 2>&1 +# 重新build面板 +# 30 7 */7 * * bash rebuild >> ${JD_DIR}/log/rebuild.log 2>&1 # 删除 RmLogDaysAgo 指定天数以前的旧日志,本行为不记录日志 57 13 * * * bash rm_log >/dev/null 2>&1 diff --git a/shell/rebuild.sh b/shell/rebuild.sh new file mode 100644 index 00000000..63cbda2f --- /dev/null +++ b/shell/rebuild.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +ShellDir=${JD_DIR:-$(cd $(dirname $0); pwd)} +JD_DIR=/jd + +echo -e "更新shell...\n" +cd ${ShellDir} +git fetch --all +git stash +git pull +git stash pop +git reset --mixed +echo -e "更新shell完成...\n" + +echo -e "重新build...\n" +yarn install +yarn build +yarn build-back +echo -e "重新build完成...\n" + +echo -e "重启服务...\n" + +pm2 start ${JD_DIR}/build/app.js +nginx -s reload + +echo -e "重启服务完成...\n" \ No newline at end of file