From 67362609cc50215c0af0c527b5a45235ff926157 Mon Sep 17 00:00:00 2001 From: Elina Akhmanova Date: Fri, 19 May 2023 10:11:49 +0000 Subject: [PATCH] Fix Signed-off-by: GitHub --- Dockerfile.e2e-test | 4 ++-- hack/push-multiarch.sh | 28 ++++++++-------------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Dockerfile.e2e-test b/Dockerfile.e2e-test index 5033dac628..11581a0113 100644 --- a/Dockerfile.e2e-test +++ b/Dockerfile.e2e-test @@ -18,8 +18,8 @@ # and has curl, gcloud, and ca-certificated preinstalled FROM gcr.io/google.com/cloudsdktool/google-cloud-cli:debian_component_based -#ARG_ARCH & ARG_BIN are replaces with sed in build/rules.mk -ADD bin/ARG_ARCH/ARG_BIN /ARG_BIN +ARG TARGETARCH +ADD bin/${TARGETARCH}/e2e-test /e2e-test COPY cmd/e2e-test/run.sh /run.sh ENTRYPOINT ["/run.sh"] diff --git a/hack/push-multiarch.sh b/hack/push-multiarch.sh index 6a12291a7e..559eceb337 100755 --- a/hack/push-multiarch.sh +++ b/hack/push-multiarch.sh @@ -44,27 +44,15 @@ docker buildx create --use for binary in ${BINARIES} do + # "arm64 amd64" ---> "linux/arm64,linux/amd64" + PLATFORMS="linux/$(echo ${ALL_ARCH} | sed 's~ ~,linux/~g')" + echo "docker buildx platform parameters: ${PLATFORMS}" MULTIARCH_IMAGE="${REGISTRY}/ingress-gce-${binary}" - MANIFEST_PARAMETERS="" - for arch in ${ALL_ARCH} - do - echo "building pushing a docker image for $binary and $arch.." - # creates arch dependant dockerfiles for every binary - sed \ - -e "s|ARG_ARCH|${arch}|g" \ - -e "s|ARG_BIN|${binary}|g" \ - "Dockerfile.${binary}" > ".dockerfile-${arch}.${binary}" - # buildx builds and pushes images for any arch - IMAGE_NAME="${REGISTRY}/ingress-gce-${binary}-$arch" - docker buildx build --platform=linux/$arch \ - -f ".dockerfile-${arch}.${binary}" \ - -t "${IMAGE_NAME}:${VERSION}" --push . - MANIFEST_PARAMETERS="$MANIFEST_PARAMETERS ${IMAGE_NAME}:${VERSION}" - done - - echo "creating a multiatch manifest $MULTIARCH_IMAGE from a list of images.." - docker manifest create ${MULTIARCH_IMAGE}:${VERSION} ${MANIFEST_PARAMETERS} - docker manifest push ${MULTIARCH_IMAGE}:${VERSION} + echo "building ${MULTIARCH_IMAGE}:${VERSION} image.." + docker buildx build --push \ + --platform ${PLATFORMS} \ + --tag ${MULTIARCH_IMAGE} \ + -f Dockerfile.${binary} . echo "done, pushed $MULTIARCH_IMAGE:$VERSION image" done