diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 2c3a385..6aa7236 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -2,8 +2,6 @@ name: "Build and push images" on: workflow_dispatch: - schedule: - - cron: 0 16 * * * jobs: Building: @@ -20,33 +18,19 @@ jobs: with: fetch-depth: 0 - - name: Check the latest verion - run: | - [ -e README_EN.md ] && NOW=$(awk '/^The latest version/{print $NF}' README_EN.md) - LATEST=$(wget -qO- "https://api.github.com/repos/naiba/nezha/releases/latest" | awk -F '"' '/"tag_name"/{print $4}') - if [ "$NOW" != "$LATEST" ]; then - sed -i "s/\(^The latest version:[ ]\+\)v.*/\1$LATEST/" README_EN.md - sed -i "s/\(^当前镜像版本:[ ]\+\)v.*/\1$LATEST/" README.md - echo "VERSION=$LATEST" >> $GITHUB_ENV - fi - - name: Set up QEMU - if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }} uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx - if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }} uses: docker/setup-buildx-action@v3.0.0 - name: Login to DockerHub - if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }} uses: docker/login-action@v3.0.0 with: username: ${{ env.DOCKER_USERNAME }} password: ${{ env.DOCKER_PASSWORD }} - name: Push images to Docker hub - if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }} uses: docker/build-push-action@v5.1.0 with: push: true @@ -55,6 +39,5 @@ jobs: - name: Upload to repository uses: stefanzweifel/git-auto-commit-action@v5.0.0 - if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }} with: commit_message: Push images ${{ env.VERSION }} by Github Actions, ${{ env.DATE }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e8e7e80..ebca30a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,18 @@ -FROM ghcr.io/naiba/nezha-dashboard - -EXPOSE 80 +FROM debian WORKDIR /dashboard -COPY entrypoint.sh /dashboard/ - -COPY sqlite.db /dashboard/data/ - RUN apt-get update &&\ - apt-get -y install openssh-server wget iproute2 vim git cron unzip supervisor systemctl nginx &&\ - chmod +x entrypoint.sh &&\ + apt-get -y install openssh-server wget iproute2 vim git cron unzip supervisor nginx &&\ git config --global core.bigFileThreshold 1k &&\ git config --global core.compression 0 &&\ git config --global advice.detachedHead false &&\ git config --global pack.threads 1 &&\ git config --global pack.windowMemory 50m &&\ apt-get clean &&\ - rm -rf /var/lib/apt/lists/* + rm -rf /var/lib/apt/lists/* &&\ + echo "#!/usr/bin/env bash\n\n\ +bash <(wget -qO- https://raw.githubusercontent.com/fscarmen2/Argo-Nezha-Service-Container/main/init.sh)" > entrypoint.sh &&\ + chmod +x entrypoint.sh ENTRYPOINT ["./entrypoint.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 76ca752..54d0552 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ 使用 Argo 隧道的哪吒服务端 -当前镜像版本: v0.15.18 - Documentation: [English version](https://github.com/fscarmen2/Argo-Nezha-Service-Container/blob/main/README_EN.md) | 中文版 * * * diff --git a/README_EN.md b/README_EN.md index 4bedac4..bcc40af 100644 --- a/README_EN.md +++ b/README_EN.md @@ -2,8 +2,6 @@ Nezha server over Argo tunnel -The latest version: v0.15.18 - Documentation: English version | [中文版](https://github.com/fscarmen2/Argo-Nezha-Service-Container/blob/main/README.md) * * * * diff --git a/entrypoint.sh b/init.sh similarity index 97% rename from entrypoint.sh rename to init.sh index c98e761..3fd0f1c 100644 --- a/entrypoint.sh +++ b/init.sh @@ -17,8 +17,13 @@ if [ ! -s /etc/supervisor/conf.d/damon.conf ]; then [[ "$ARGO_AUTH" =~ ey[A-Z0-9a-z=]{120,250}$ ]] && ARGO_AUTH=$(awk '{print $NF}' <<< "$ARGO_AUTH") # Token 复制全部,只取最后的 ey 开始的 [ -n "$GH_REPO" ] && grep -q '/' <<< "$GH_REPO" && GH_REPO=$(awk -F '/' '{print $NF}' <<< "$GH_REPO") # 填了项目全路径的处理 + # 设置 DNS echo -e "nameserver 127.0.0.11\nnameserver 8.8.4.4\nnameserver 223.5.5.5\nnameserver 2001:4860:4860::8844\nnameserver 2400:3200::1\n" > /etc/resolv.conf + # 设置 +8 时区 (北京时间) + ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + dpkg-reconfigure -f noninteractive tzdata + # 判断处理器架构 case $(uname -m) in aarch64|arm64 ) ARCH=arm64 ;; @@ -68,11 +73,14 @@ EOF fi # 下载需要的应用 + DASHBOARD_LATEST=$(wget -qO- "https://api.github.com/repos/naiba/nezha/releases/latest" | awk -F '"' '/"tag_name"/{print $4}') + wget -O /tmp/dashboard.zip https://github.com/naiba/nezha/releases/download/$DASHBOARD_LATEST/dashboard-linux-$ARCH.zip + unzip /tmp/dashboard.zip -d /tmp + mv -f /tmp/dist/dashboard-linux-$ARCH $WORK_DIR/app wget -qO $WORK_DIR/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-$ARCH wget -O $WORK_DIR/nezha-agent.zip https://github.com/nezhahq/agent/releases/latest/download/nezha-agent_linux_$ARCH.zip unzip $WORK_DIR/nezha-agent.zip -d $WORK_DIR/ - - rm -f $WORK_DIR/nezha-agent.zip + rm -rf $WORK_DIR/nezha-agent.zip /tmp/dist /tmp/dashboard.zip # 根据参数生成哪吒服务端配置文件 [ ! -d data ] && mkdir data