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:
1 parent
59320aa410
commit
4010b4fd70
3 files changed
+15
-6
No files matched your search
+11
-4
@@ -88,10 +88,15 @@ RUN go mod download
|
|||||||
|
|
||||||
COPY agent/ ./
|
COPY agent/ ./
|
||||||
|
|
||||||
# 编译容器目标架构 Linux Agent,同时固定产出 Windows AMD64 便于 Windows 主机下载安装。 // Logan.Li
|
# 交叉编译主流服务器平台 Agent:Linux x86_64 / Linux ARM64 / Windows x86_64。
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build \
|
# 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}" \
|
-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 \
|
RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \
|
||||||
-ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \
|
-ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \
|
||||||
-o bin/aiops-agent-windows-amd64.exe .
|
-o bin/aiops-agent-windows-amd64.exe .
|
||||||
@@ -128,7 +133,9 @@ RUN addgroup -S -g 10001 aiops && \
|
|||||||
chmod 1777 /tmp
|
chmod 1777 /tmp
|
||||||
|
|
||||||
# 复制 agent 二进制。 // Logan.Li
|
# 复制 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
|
COPY --from=agent-builder /agent/bin/aiops-agent-windows-amd64.exe /app/agent/bin/aiops-agent-windows-amd64.exe
|
||||||
|
|
||||||
# 复制 agent 安装脚本
|
# 复制 agent 安装脚本
|
||||||
|
|||||||
+3
-1
@@ -43,7 +43,9 @@ services:
|
|||||||
- "127.0.0.1:6379:6379"
|
- "127.0.0.1:6379:6379"
|
||||||
volumes:
|
volumes:
|
||||||
- redis_data:/data
|
- redis_data:/data
|
||||||
command: redis-server --appendonly yes
|
# appendonly: 分时热数据需持久化,避免重启丢窗口;
|
||||||
|
# maxmemory + volatile-lru: 只淘汰带 TTL 的键(ZSET 热数据),保护 SetNX 分布式锁等无 TTL 键。 // Logan.Li
|
||||||
|
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy volatile-lru --maxmemory-samples 5
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ Agent 执行完任务后,回传执行结果。
|
|||||||
"downloads": {
|
"downloads": {
|
||||||
"linux_amd64": "/api/v1/agent/aiops-agent-linux-amd64",
|
"linux_amd64": "/api/v1/agent/aiops-agent-linux-amd64",
|
||||||
"linux_arm64": "/api/v1/agent/aiops-agent-linux-arm64",
|
"linux_arm64": "/api/v1/agent/aiops-agent-linux-arm64",
|
||||||
"darwin_arm64": "/api/v1/agent/aiops-agent-darwin-arm64"
|
"windows_amd64": "/api/v1/agent/aiops-agent-windows-amd64.exe"
|
||||||
},
|
},
|
||||||
"install_script": "/api/v1/agent/install.sh"
|
"install_script": "/api/v1/agent/install.sh"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user