🚸 大幅缩减 agent 二进制体积

This commit is contained in:
naiba 2021-04-28 23:21:54 +08:00
parent 8950816df4
commit 584e406af1
5 changed files with 14 additions and 4 deletions

View File

@ -10,6 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: |
wget https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz
tar --strip-components=1 -xf upx-3.95-amd64_linux.tar.xz && mv upx /usr/bin/
upx --version
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')

View File

@ -3,6 +3,8 @@ before:
- go mod tidy -v
builds:
- id: nezha-agent
ldflags:
- -s -w
env:
- CGO_ENABLED=0
goos:
@ -25,6 +27,10 @@ builds:
goarch: arm64
main: ./cmd/agent
binary: nezha-agent
hooks:
post:
# 为路由器、开发板缩小二进制体积
- npx --best "{{.Path}}"
checksum:
name_template: "checksums.txt"
snapshot:

View File

@ -1,7 +1,7 @@
<div align="center" style="background-color: white">
<img width="500" style="max-width:100%" src="https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.png" title="哪吒监控">
<br><br>
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.6.6&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.4.10-brightgreen?style=for-the-badge&logo=linux">
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.6.6&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.5.0-brightgreen?style=for-the-badge&logo=linux">
<br>
<p>:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>
</div>

View File

@ -2,7 +2,7 @@ version: "3.3"
services:
dashboard:
image: image_url
image: nz_image_url
restart: always
volumes:
- ./data:/dashboard/data

View File

@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
NZ_VERSION="v0.4.10"
NZ_VERSION="v0.5.0"
red='\033[0;31m'
green='\033[0;32m'
@ -266,7 +266,7 @@ modify_dashboard_config() {
sed -i "s/nz_site_title/${nz_site_title}/" ${NZ_DASHBOARD_PATH}/data/config.yaml
sed -i "s/nz_site_port/${nz_site_port}/" ${NZ_DASHBOARD_PATH}/docker-compose.yaml
sed -i "s/nz_grpc_port/${nz_grpc_port}/" ${NZ_DASHBOARD_PATH}/docker-compose.yaml
sed -i "s/image_url/${Docker_IMG}/" ${NZ_DASHBOARD_PATH}/docker-compose.yaml
sed -i "s/nz_image_url/${Docker_IMG}/" ${NZ_DASHBOARD_PATH}/docker-compose.yaml
echo -e "面板配置 ${green}修改成功,请稍等重启生效${plain}"