From 2fe8c382935bc5161c59a3db2d7b0507a3fecf19 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Wed, 30 Jun 2021 23:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=95=9C=E5=83=8F=E6=89=93?= =?UTF-8?q?=E5=8C=85=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 3 +-- back/services/env.ts | 2 +- docker/Dockerfile | 5 +++++ docker/docker-entrypoint.sh | 17 +++++++++-------- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1464ced1..dd661c43 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -46,7 +46,6 @@ jobs: - name: Docker buildx image and push on release env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - if: startsWith(github.ref, 'refs/heads/') + if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/master' run: | docker buildx build --build-arg SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" --output "type=image,push=true" --platform=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x --tag whyour/qinglong:${{steps.version.outputs.result}} docker/ - docker buildx build --build-arg SSH_PRIVATE_KEY="${SSH_PRIVATE_KEY}" --output "type=image,push=true" --platform=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/s390x --tag whyour/qinglong:latest docker/ diff --git a/back/services/env.ts b/back/services/env.ts index a8e601e0..98f40638 100644 --- a/back/services/env.ts +++ b/back/services/env.ts @@ -19,7 +19,7 @@ export default class EnvService { public async create(payload: Env): Promise { const envs = await this.envs(); let position = initEnvPosition; - if (envs && envs.length > 0) { + if (envs && envs.length > 0 && envs[envs.length - 1].position) { position = envs[envs.length - 1].position; } const tab = new Env({ ...payload, position: position / 2 }); diff --git a/docker/Dockerfile b/docker/Dockerfile index 3d25a854..046c1ded 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,6 +37,11 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && cp -f .env.example .env \ && chmod 777 ${QL_DIR}/shell/*.sh \ && chmod 777 ${QL_DIR}/docker/*.sh \ + && yarn install \ + && yarn build \ + && yarn build-back \ + && yarn cache clean \ + && rm -rf node_modules \ && npm install -g pm2 \ && npm install -g pnpm \ && rm -rf /root/.npm \ diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 8f223ef8..478b71bf 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -7,18 +7,14 @@ link_shell echo -e "======================1. 检测配置文件========================\n" fix_config cp -fv $dir_root/docker/front.conf /etc/nginx/conf.d/front.conf -echo - -echo -e "======================2. 更新源代码========================\n" -ql update "no-restart" pm2 l >/dev/null 2>&1 echo -echo -e "======================3. 启动nginx========================\n" +echo -e "======================2. 启动nginx========================\n" nginx -s reload 2>/dev/null || nginx -c /etc/nginx/nginx.conf echo -e "nginx启动成功...\n" -echo -e "======================4. 启动控制面板========================\n" +echo -e "======================3. 启动控制面板========================\n" if [[ $(pm2 info panel 2>/dev/null) ]]; then pm2 reload panel --source-map-support --time else @@ -26,7 +22,7 @@ else fi echo -e "控制面板启动成功...\n" -echo -e "======================5. 启动定时任务========================\n" +echo -e "======================4. 启动定时任务========================\n" if [[ $(pm2 info schedule 2>/dev/null) ]]; then pm2 reload schedule --source-map-support --time else @@ -35,10 +31,15 @@ fi echo -e "定时任务启动成功...\n" if [[ $AutoStartBot == true ]]; then - echo -e "======================6. 启动bot========================\n" + echo -e "======================5. 启动bot========================\n" ql bot fi +if [[ $EnableExtraShell == true ]]; then + echo -e "======================6. 执行自定义脚本========================\n" + ql extra +fi + echo -e "############################################################\n" echo -e "容器启动成功..." echo -e "\n请先访问5700端口,登录成功面板之后再执行添加定时任务..."