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
+9
-10
@@ -94,14 +94,15 @@ FROM alpine:3.20
|
||||
ARG TARGETARCH
|
||||
ARG KUBECTL_VERSION=v1.32.2
|
||||
|
||||
# 安装运行时依赖(核心最小集,重型工具改为懒加载)// Logan.Li
|
||||
# kubectl 从本地 backend/kubectl 复制(预打包进镜像,避免网络下载)// Logan.Li
|
||||
COPY scripts/setup-alpine-mirrors.sh /tmp/setup-alpine-mirrors.sh
|
||||
# 安装运行时依赖(U4 镜像瘦身 — 核心最小集, git/docker-cli 改为懒加载)// Logan.Li
|
||||
# kubectl 通过 install-kubectl.sh 下载(避免构建上下文携带 60MB 二进制)// Logan.Li
|
||||
COPY scripts/setup-alpine-mirrors.sh scripts/install-kubectl.sh /tmp/
|
||||
RUN chmod +x /tmp/setup-alpine-mirrors.sh && /tmp/setup-alpine-mirrors.sh && \
|
||||
apk --no-cache add ca-certificates tzdata bash curl git docker-cli docker-cli-buildx
|
||||
COPY backend/kubectl /usr/local/bin/kubectl
|
||||
RUN chmod +x /usr/local/bin/kubectl && \
|
||||
rm -f /tmp/setup-alpine-mirrors.sh
|
||||
apk add --no-cache ca-certificates tzdata bash curl && \
|
||||
chmod +x /tmp/install-kubectl.sh && \
|
||||
TARGET_OS=linux TARGET_ARCH="${TARGETARCH}" KUBECTL_VERSION="${KUBECTL_VERSION}" \
|
||||
/tmp/install-kubectl.sh /usr/local/bin/kubectl && \
|
||||
rm -f /tmp/setup-alpine-mirrors.sh /tmp/install-kubectl.sh
|
||||
|
||||
# Maven 阿里云镜像加速(maven 懒加载后生效)
|
||||
RUN mkdir -p /root/.m2 && \
|
||||
@@ -120,10 +121,8 @@ COPY --from=backend-builder /app/aiops .
|
||||
# 创建运行时目录
|
||||
RUN mkdir -p /app/agent/bin /app/agent/deploy
|
||||
|
||||
# 复制 agent 二进制
|
||||
# 复制 agent 二进制(U4: 仅 linux-amd64 内置, arm64/darwin 通过下载 API 提供)// Logan.Li
|
||||
COPY --from=agent-builder /agent/bin/aiops-agent-linux-amd64 /app/agent/bin/
|
||||
COPY --from=agent-builder /agent/bin/aiops-agent-linux-arm64 /app/agent/bin/
|
||||
COPY --from=agent-builder /agent/bin/aiops-agent-darwin-arm64 /app/agent/bin/
|
||||
|
||||
# 复制 agent 安装脚本
|
||||
COPY agent/deploy/install.sh /app/agent/deploy/
|
||||
|
||||
Reference in new issue
Block a user