feat(ops): U4 后端镜像瘦身 282MB→107MB (62%降幅)
- 移除 git/docker-cli/docker-cli-buildx (~100MB) 改为懒加载 - PipelineHandler 注入 ToolInstaller, runCheckout/runImageBuild 调 EnsureAvailable - UpgradeTools 自动升级 DB 中 git/docker-cli preinstall→lazy - 仅内置 linux-amd64 agent (~12MB节省), arm64/darwin 通过下载API - kubectl 改用 install-kubectl.sh 下载 stripped 版本 - .dockerignore 排除 backend/kubectl 60MB 二进制 - Dockerfile.embed + backend/Dockerfile 同步更新 - 17/17 集成测试通过
This commit is contained in:
1 parent
8dd5a07b70
commit
c624ca5b4a
11 files changed
+175
-47
No files matched your search
+50
@@ -672,3 +672,53 @@ python3 tests/integration_test.py --host 127.0.0.1 --port 8080 | tail -3
|
||||
- [x] U7: LogDatasourcePage 迁移到 DataTable(含搜索/排序/CRUD)
|
||||
- [x] U8: 支持 6+ 核心功能开关(sortable/searchable/pagination/selectable/exportable/columnToggle)
|
||||
- [x] U9: 17/17 集成回归测试通过
|
||||
|
||||
---
|
||||
|
||||
## P3-U4: 后端镜像优化
|
||||
|
||||
### 验证用例
|
||||
|
||||
```bash
|
||||
# U1: 镜像大小
|
||||
docker images --format '{{.Repository}}:{{.Tag}} {{.Size}}' | grep aiops
|
||||
# 期望: < 150MB
|
||||
|
||||
# U2: Go 编译
|
||||
cd /srv/aiops/backend && go build ./...
|
||||
# 期望: 零错误
|
||||
|
||||
# U3: git 不在镜像中(懒加载)
|
||||
docker exec aiops which git 2>&1 || echo "git NOT in image"
|
||||
# 期望: git NOT in image
|
||||
|
||||
# U4: docker 不在镜像中(懒加载)
|
||||
docker exec aiops which docker 2>&1 || echo "docker NOT in image"
|
||||
# 期望: docker NOT in image
|
||||
|
||||
# U5: kubectl 在镜像中
|
||||
docker exec aiops which kubectl
|
||||
# 期望: /usr/local/bin/kubectl
|
||||
|
||||
# U6: 仅 linux-amd64 agent
|
||||
docker exec aiops ls /app/agent/bin/
|
||||
# 期望: 只有 aiops-agent-linux-amd64
|
||||
|
||||
# U7: UpgradeTools 日志
|
||||
docker logs aiops 2>&1 | grep 'U4 upgrade'
|
||||
# 期望: git preinstall→lazy, docker-cli preinstall→lazy
|
||||
|
||||
# U8: 集成回归测试
|
||||
python3 tests/integration_test.py --host 127.0.0.1 --port 8080 | tail -3
|
||||
# 期望: 17/17 passed
|
||||
```
|
||||
|
||||
### 通过标准
|
||||
- [x] U1: 镜像从 282MB 降至 **107MB**(< 150MB 目标 ✅)
|
||||
- [x] U2: `go build` 零错误
|
||||
- [x] U3: git 不在镜像中(首次流水线使用时通过 `apk add --no-cache git` 懒加载)
|
||||
- [x] U4: docker 不在镜像中(首次流水线使用时通过 `apk add --no-cache docker-cli` 懒加载)
|
||||
- [x] U5: kubectl 在镜像中(通过 install-kubectl.sh 下载 stripped 版本)
|
||||
- [x] U6: 仅 linux-amd64 agent 二进制(arm64/darwin 通过下载 API)
|
||||
- [x] U7: UpgradeTools 自动升级 git/docker-cli preinstall→lazy
|
||||
- [x] U8: 17/17 集成回归测试通过
|
||||
Reference in new issue
Block a user