Files
aiops/agent/Makefile
T
attacker ac0b8e75c0 feat: add monitoring agent (Go) + agent report API + cloud billing UI
- Go agent: CPU/mem/disk/port collectors, HTTP report, static binary
- Cross-compile: linux/amd64 + linux/arm64 (statically linked)
- One-line install script for all Linux distros
- Backend: POST /api/v1/agent/report (no JWT) + GET /agent/latest,history (JWT)
- CloudBilling.tsx: fixed syntax errors, stats/trends/records/alerts
- K8s menu renamed to Kubernetes管理

Signed-off-by: Logan.Li
2026-06-14 21:27:14 +08:00

55 lines
1.5 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Makefile for AIOps Agent
# 提供本地构建、交叉编译及常用开发任务
# 署名 Logan.Li
APP := aiops-agent
VERSION := 1.0.0
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
# 注入版本信息;-s -w 去除调试符号以缩减二进制体积
LDFLAGS := -s -w -X main.version=$(VERSION) -X main.buildTime=$(BUILD_TIME)
# 静态编译:关闭 CGO 并使用静态链接
LINUX_LDFLAGS := -extldflags "-static"
.PHONY: build cross build-linux-amd64 build-linux-arm64 tidy run fmt vet clean help
## build: 本地构建当前平台二进制
build:
go build -ldflags "$(LDFLAGS)" -o $(APP) .
## cross: 交叉编译 Linux amd64 与 arm64(静态链接,适合容器/嵌入式部署)
cross: build-linux-amd64 build-linux-arm64
## build-linux-amd64: 交叉编译 linux/amd64
build-linux-amd64:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "$(LDFLAGS) $(LINUX_LDFLAGS)" -o bin/$(APP)-linux-amd64 .
## build-linux-arm64: 交叉编译 linux/arm64
build-linux-arm64:
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 \
go build -ldflags "$(LDFLAGS) $(LINUX_LDFLAGS)" -o bin/$(APP)-linux-arm64 .
## tidy: 整理依赖
tidy:
go mod tidy
## run: 本地运行(默认连接 localhost:8080)
run:
go run . -server http://localhost:8080 -interval 10
## fmt: 格式化代码
fmt:
go fmt ./...
## vet: 静态检查
vet:
go vet ./...
## clean: 清理构建产物
clean:
rm -rf bin $(APP)
## help: 显示帮助
help:
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## //' | column -t -s ':'