From 7d30b0ec4e02168676876e4b78651baf5d0b0ff4 Mon Sep 17 00:00:00 2001 From: CarlosEDP Date: Mon, 11 Jun 2018 10:31:49 -0500 Subject: [PATCH] Update image build script --- Readme.md | 12 ++++++-- build_images.sh | 81 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 84 insertions(+), 9 deletions(-) diff --git a/Readme.md b/Readme.md index b401481..607a2be 100644 --- a/Readme.md +++ b/Readme.md @@ -57,7 +57,7 @@ This project depends on the following images: **Prometheus-operator** * Source: https://github.com/carlosedp/prometheus-operator -* Autobuild: +* Autobuild: No autobuild yet. Use provided `build_images.sh` script. * Images: https://hub.docker.com/r/carlosedp/prometheus-operator **Grafana** @@ -69,13 +69,13 @@ This project depends on the following images: **Kube-state-metrics** * Source: https://github.com/kubernetes/kube-state-metrics -* Autobuild: +* Autobuild: No autobuild yet. Use provided `build_images.sh` script. * Images: https://hub.docker.com/r/carlosedp/kube-state-metrics **Addon-resizer** * Source: -* Autobuild: +* Autobuild: No autobuild yet. Use provided `build_images.sh` script. * Images: https://hub.docker.com/r/carlosedp/addon-resizer *Obs.* This image is a clone of [ARM64](https://console.cloud.google.com/gcr/images/google-containers/GLOBAL/addon-resizer-arm64) and [ARM](https://console.cloud.google.com/gcr/images/google-containers/GLOBAL/addon-resizer-arm64) with a manifest. It's cloned and generated by the `build_images.sh` script @@ -86,6 +86,12 @@ This project depends on the following images: * Autobuild: https://travis-ci.org/carlosedp/configmap-reload * Images: https://hub.docker.com/r/carlosedp/configmap-reload +**prometheus-config-reloader** + +* Source: https://github.com/coreos/prometheus-operator/tree/master/contrib/prometheus-config-reloader +* Autobuild: No autobuild yet. Use provided `build_images.sh` script. +* Images: https://hub.docker.com/r/carlosedp/prometheus-config-reloader + **SMTP-server** Source: https://github.com/carlosedp/docker-smtp diff --git a/build_images.sh b/build_images.sh index 557b452..adbc6c6 100644 --- a/build_images.sh +++ b/build_images.sh @@ -1,20 +1,89 @@ #!/bin/bash +REPO=carlosedp + # Retag Addon-resizer google images to have unified manifest on DockerHub AOM_VERSION=2.1 docker pull gcr.io/google-containers/addon-resizer-arm64:$AOM_VERSION docker pull gcr.io/google-containers/addon-resizer-arm:$AOM_VERSION -docker tag gcr.io/google-containers/addon-resizer-arm64:$AOM_VERSION carlosedp/addon-resizer:$AOM_VERSION-arm64 -docker tag gcr.io/google-containers/addon-resizer-arm:$AOM_VERSION carlosedp/addon-resizer:$AOM_VERSION-arm +docker tag gcr.io/google-containers/addon-resizer-arm64:$AOM_VERSION $REPO/addon-resizer:$AOM_VERSION-arm64 +docker tag gcr.io/google-containers/addon-resizer-arm:$AOM_VERSION $REPO/addon-resizer:$AOM_VERSION-arm -docker push carlosedp/addon-resizer:$AOM_VERSION-arm -docker push carlosedp/addon-resizer:$AOM_VERSION-arm64 +docker push $REPO/addon-resizer:$AOM_VERSION-arm +docker push $REPO/addon-resizer:$AOM_VERSION-arm64 -manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template carlosedp/addon-resizer:$AOM_VERSION-ARCH --target carlosedp/addon-resizer:$AOM_VERSION -manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template carlosedp/addon-resizer:$AOM_VERSION-ARCH --target carlosedp/addon-resizer:latest +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/addon-resizer:$AOM_VERSION-ARCH --target $REPO/addon-resizer:$AOM_VERSION +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/addon-resizer:$AOM_VERSION-ARCH --target $REPO/addon-resizer:latest +# Kube-state-metrics +KSM_VERSION=v1.3.0 +go get github.com/kubernetes/kube-state-metrics +mv $HOME/go/src/github.com/kubernetes/kube-state-metrics $HOME/go/src/k8s.io/kube-state-metrics +cd $HOME/go/src/k8s.io/kube-state-metrics +git checkout ${KSM_VERSION} +GOOS=linux GOARCH=arm go build . +docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-arm . + +GOOS=linux GOARCH=arm64 go build . +docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-arm64 . + +docker push $REPO/kube-state-metrics:$KSM_VERSION-arm +docker push $REPO/kube-state-metrics:$KSM_VERSION-arm64 + +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/kube-state-metrics:$KSM_VERSION-ARCH --target $REPO/kube-state-metrics:$KSM_VERSION +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/kube-state-metrics:$KSM_VERSION-ARCH --target $REPO/kube-state-metrics:latest +# Prometheus-operator + +VERSION=v0.20.0 +go get github.com/coreos/prometheus-operator +cd $HOME/go/src/github.com/coreos/prometheus-operator +git checkout ${VERSION} + + +go get -u github.com/prometheus/promu + +cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM busybox/' > Dockerfile.arm + + +GOOS=linux GOARCH=arm $GOPATH/bin/promu build --prefix `pwd` +docker build -t $REPO/prometheus-operator:${VERSION}-arm -f Dockerfile.arm . + +GOOS=linux GOARCH=arm64 $GOPATH/bin/promu build --prefix `pwd` +docker build -t $REPO/prometheus-operator:${VERSION}-arm64 -f Dockerfile.arm . + +docker push $REPO/prometheus-operator:$VERSION-arm +docker push $REPO/prometheus-operator:$VERSION-arm64 + +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/prometheus-operator:$VERSION-ARCH --target $REPO/prometheus-operator:$VERSION +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/prometheus-operator:$VERSION-ARCH --target $REPO/prometheus-operator:latest + +rm Dockerfile.arm + +# prometheus-config-reloader + +VERSION=v0.20.0 +go get github.com/coreos/prometheus-operator +cd $HOME/go/src/github.com/coreos/prometheus-operator/ +git checkout ${VERSION} +cd $HOME/go/src/github.com/coreos/prometheus-operator/contrib/prometheus-config-reloader + +cat Dockerfile |sed -e 's/^FROM.*/FROM busybox/' > Dockerfile.arm + +GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -o prometheus-config-reloader main.go +docker build -t $REPO/prometheus-config-reloader:${VERSION}-arm -f Dockerfile.arm . + +GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o prometheus-config-reloader main.go +docker build -t $REPO/prometheus-config-reloader:${VERSION}-arm64 -f Dockerfile.arm . + +docker push $REPO/prometheus-config-reloader:$VERSION-arm +docker push $REPO/prometheus-config-reloader:$VERSION-arm64 + +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/prometheus-config-reloader:$VERSION-ARCH --target $REPO/prometheus-config-reloader:$VERSION +manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64 --template $REPO/prometheus-config-reloader:$VERSION-ARCH --target $REPO/prometheus-config-reloader:latest + +rm Dockerfile.arm