build: 镜像内置 Linux amd64/arm64 + Windows amd64 三平台 Agent,固定版本 v1.0.1

- Dockerfile/backend/Dockerfile: 显式交叉编译 linux-amd64、linux-arm64、
  windows-amd64.exe(原实现只产出容器目标架构,ARM 主机会下载 404)
- 移除 darwin-arm64:服务器采集场景极少见,不再产出也不在清单中声明
- router/agent_static.go、run.sh、文档同步对齐实际产出清单

// Logan.Li
This commit is contained in:
Logan.Li committed 2026-09-14 08:23:36 +00:00
1 parent 59320aa410
commit 4010b4fd70
3 files changed
+15 -6

No files matched your search

+11 -4
View File
@@ -88,10 +88,15 @@ RUN go mod download
COPY agent/ ./
# 编译容器目标架构 Linux Agent,同时固定产出 Windows AMD64 便于 Windows 主机下载安装。 // Logan.Li
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build \
# 交叉编译主流服务器平台 Agent:Linux x86_64 / Linux ARM64 / Windows x86_64。
# Go 在 CGO_ENABLED=0 下可原生交叉编译,无需 QEMU,故一次性产出全部目标,
# 与 router/agent_static.go 的下载清单保持一致,避免 ARM 主机下载 404。 // Logan.Li
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \
-o bin/aiops-agent-linux-${TARGETARCH} .
-o bin/aiops-agent-linux-amd64 .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build \
-ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \
-o bin/aiops-agent-linux-arm64 .
RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \
-ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \
-o bin/aiops-agent-windows-amd64.exe .
@@ -128,7 +133,9 @@ RUN addgroup -S -g 10001 aiops && \
chmod 1777 /tmp
# 复制 agent 二进制。 // Logan.Li
COPY --from=agent-builder /agent/bin/aiops-agent-linux-${TARGETARCH} /app/agent/bin/aiops-agent-linux-${TARGETARCH}
# 复制主流平台 agent 二进制(与 router/agent_static.go 的下载清单一一对应)。 // Logan.Li
COPY --from=agent-builder /agent/bin/aiops-agent-linux-amd64 /app/agent/bin/aiops-agent-linux-amd64
COPY --from=agent-builder /agent/bin/aiops-agent-linux-arm64 /app/agent/bin/aiops-agent-linux-arm64
COPY --from=agent-builder /agent/bin/aiops-agent-windows-amd64.exe /app/agent/bin/aiops-agent-windows-amd64.exe
# 复制 agent 安装脚本