diff --git a/kustomize.Dockerfile b/kustomize.Dockerfile index 66f59ee926..48fab6b0bc 100644 --- a/kustomize.Dockerfile +++ b/kustomize.Dockerfile @@ -1,15 +1,16 @@ # Copyright 2022 The Kubernetes Authors. # SPDX-License-Identifier: Apache-2.0 +ARG TARGETARCH TARGETOS # build -FROM public.ecr.aws/docker/library/golang:1.22.7-bullseye as builder +FROM --platform=${BUILDPLATFORM} public.ecr.aws/docker/library/golang:1.22.7-bullseye as builder ARG VERSION ARG COMMIT ARG DATE RUN mkdir /build ADD . /build/ WORKDIR /build/kustomize -RUN CGO_ENABLED=0 GO111MODULE=on go build \ +RUN CGO_ENABLED=0 GO111MODULE=on GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \ -ldflags="-s -X sigs.k8s.io/kustomize/api/provenance.version=${VERSION} \ -X sigs.k8s.io/kustomize/api/provenance.buildDate=${DATE}" diff --git a/releasing/cloudbuild_kustomize_image.yaml b/releasing/cloudbuild_kustomize_image.yaml index 605b292171..b02725a524 100644 --- a/releasing/cloudbuild_kustomize_image.yaml +++ b/releasing/cloudbuild_kustomize_image.yaml @@ -9,13 +9,26 @@ steps: - "PROJECT_ID=$PROJECT_ID" - "_GIT_TAG=$_GIT_TAG" - "_PULL_BASE_REF=$_PULL_BASE_REF" -# We need to use bash to configure the build date and version properly. - name: "gcr.io/cloud-builders/docker" entrypoint: /bin/bash args: - -c - > docker + buildx + create + --name + builder + --use + --bootstrap + # We need to use bash to configure the build date and version properly. + - name: "gcr.io/cloud-builders/docker" + entrypoint: /bin/bash + args: + - -c + - > + docker + buildx build -t gcr.io/$PROJECT_ID/kustomize:${_GIT_TAG} @@ -29,6 +42,8 @@ steps: COMMIT=$(git rev-parse HEAD) --build-arg DATE=$(date -u +%FT%TZ) + --platform + linux/amd64,linux/arm64 . images: