From 6405a1ecf70042ee4cc9fe71861cd925eed3a739 Mon Sep 17 00:00:00 2001 From: CarlosEDP Date: Mon, 4 Feb 2019 17:22:30 -0200 Subject: [PATCH] Fix image building script --- build_images.sh | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) mode change 100644 => 100755 build_images.sh diff --git a/build_images.sh b/build_images.sh old mode 100644 new mode 100755 index 66adf74..dda3680 --- a/build_images.sh +++ b/build_images.sh @@ -42,7 +42,7 @@ ALL_ARCH='amd64 arm arm64' docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done -docker manifest push $IMAGE:$VERSION +docker manifest push --purge $IMAGE:$VERSION #------------------------------------------------------------------------------- # Prometheus-adapter # Retag prometheus-adapter from directxman12 images to have unified manifest on DockerHub @@ -72,7 +72,7 @@ ALL_ARCH='amd64 arm arm64' docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done -docker manifest push $IMAGE:$VERSION +docker manifest push --purge $IMAGE:$VERSION #------------------------------------------------------------------------------- # Kube-state-metrics @@ -92,26 +92,22 @@ cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^ cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM amd64\/alpine:3.7/' > Dockerfile.amd64 -GOOS=linux GOARCH=arm go build . +CGO_ENABLED=0 GOOS=linux GOARCH=arm go build . docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-arm -f Dockerfile.arm . -GOOS=linux GOARCH=arm64 go build . +CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build . docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-arm64 -f Dockerfile.arm64 . -GOOS=linux GOARCH=amd64 go build . +CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags '-extldflags "-static"' . docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-amd64 -f Dockerfile.amd64 . docker push $REPO/kube-state-metrics:$KSM_VERSION-arm docker push $REPO/kube-state-metrics:$KSM_VERSION-arm64 docker push $REPO/kube-state-metrics:$KSM_VERSION-amd64 -docker rmi $REPO/kube-state-metrics:$KSM_VERSION-arm -docker rmi $REPO/kube-state-metrics:$KSM_VERSION-arm64 -docker rmi $REPO/kube-state-metrics:$KSM_VERSION-amd64 - docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done -docker manifest push $IMAGE:$VERSION +docker manifest push --purge $IMAGE:$VERSION popd #------------------------------------------------------------------------------- @@ -148,7 +144,7 @@ docker push $REPO/prometheus-operator:$VERSION-amd64 docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done -docker manifest push $IMAGE:$VERSION +docker manifest push --purge $IMAGE:$VERSION rm Dockerfile.arm rm Dockerfile.arm64 @@ -184,7 +180,7 @@ EXPOSE 8080 EOF cat > Dockerfile.amd64 <