Skip to content

Commit

Permalink
Rebuild Nezha-Argo image.
Browse files Browse the repository at this point in the history
  • Loading branch information
fscarmen2 committed Dec 8, 2023
1 parent 10166c0 commit da7e02d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: "Build and push images"

on:
workflow_dispatch:
schedule:
- cron: 0 16 * * *

jobs:
Building:
Expand All @@ -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/[email protected]

- name: Set up Docker Buildx
if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }}
uses: docker/[email protected]

- name: Login to DockerHub
if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }}
uses: docker/[email protected]
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/[email protected]
with:
push: true
Expand All @@ -55,6 +39,5 @@ jobs:

- name: Upload to repository
uses: stefanzweifel/[email protected]
if: ${{ env.VERSION != '' || github.event_name == 'workflow_dispatch' }}
with:
commit_message: Push images ${{ env.VERSION }} by Github Actions, ${{ env.DATE }}
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

使用 Argo 隧道的哪吒服务端

当前镜像版本: v0.15.18

Documentation: [English version](https://github.com/fscarmen2/Argo-Nezha-Service-Container/blob/main/README_EN.md) | 中文版

* * *
Expand Down
2 changes: 0 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

* * * *
Expand Down
12 changes: 10 additions & 2 deletions entrypoint.sh → init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit da7e02d

Please sign in to comment.