From 64595cc0f7e0c10d7545f4150facad464e346d11 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Thu, 28 Sep 2023 20:30:05 +0800 Subject: [PATCH] Add go clean in Dockerfile and action. Signed-off-by: Xun Jiang --- .github/workflows/push.yml | 5 ++++- Dockerfile | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c4818c39b4..810dc2f7b9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -48,7 +48,10 @@ jobs: version: latest - name: Build - run: make local + run: | + make local + # Clean go cache to ease the build environment storage pressure. + go clean -modcache -cache - name: Test run: make test diff --git a/Dockerfile b/Dockerfile index 587a0e0988..b853cb89d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,8 @@ RUN mkdir -p /output/usr/bin && \ go build -o /output/${BIN} \ -ldflags "${LDFLAGS}" ${PKG}/cmd/${BIN} && \ go build -o /output/velero-helper \ - -ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper + -ldflags "${LDFLAGS}" ${PKG}/cmd/velero-helper && \ + go clean -modcache -cache # Restic binary build section FROM --platform=$BUILDPLATFORM golang:1.20-bullseye as restic-builder @@ -65,7 +66,8 @@ COPY . /go/src/github.com/vmware-tanzu/velero RUN mkdir -p /output/usr/bin && \ export GOARM=$(echo "${GOARM}" | cut -c2-) && \ - /go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh + /go/src/github.com/vmware-tanzu/velero/hack/build-restic.sh && \ + go clean -modcache -cache # Velero image packing section FROM gcr.io/distroless/base-nossl-debian11:nonroot