-
Notifications
You must be signed in to change notification settings - Fork 797
/
push-images
executable file
·65 lines (52 loc) · 1.59 KB
/
push-images
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IMAGES=$(make images)
IMAGE_TAG=${IMAGE_TAG:-$(./tools/image-tag)}
QUAY_PREFIX=quay.io/
NO_QUAY=
usage() {
echo "$0 (-noquay)"
exit 2
}
while [ $# -gt 0 ]; do
case "$1" in
"-noquay")
NO_QUAY=true
shift 1
;;
*)
usage
exit 2
;;
esac
done
push_image() {
local image="$1"
for arch in amd64 arm64; do \
echo "Pushing ${image}-linux:${IMAGE_TAG}-$arch"
docker tag ${image}:${IMAGE_TAG}-$arch ${image}-linux:${IMAGE_TAG}-$arch
docker push ${image}-linux:${IMAGE_TAG}-$arch
done;
docker manifest create ${image}:${IMAGE_TAG} --amend ${image}-linux:${IMAGE_TAG}-amd64 --amend ${image}-linux:${IMAGE_TAG}-arm64
docker manifest push ${image}:${IMAGE_TAG}
if [ -n "${NO_QUAY}" ]; then
return
fi
# remove the quay prefix and push to docker hub
docker_hub_image=${image#$QUAY_PREFIX}
for arch in amd64 arm64; do \
docker tag ${image}:${IMAGE_TAG}-$arch ${docker_hub_image}-linux:${IMAGE_TAG}-$arch
echo "Pushing ${docker_hub_image}-linux:${IMAGE_TAG}-$arch"
docker push ${docker_hub_image}-linux:${IMAGE_TAG}-$arch
done;
docker manifest create ${docker_hub_image}:${IMAGE_TAG} --amend ${docker_hub_image}-linux:${IMAGE_TAG}-amd64 --amend ${docker_hub_image}-linux:${IMAGE_TAG}-arm64
docker manifest push ${docker_hub_image}:${IMAGE_TAG}
}
for image in ${IMAGES}; do
if [[ "$image" == *"build"* ]]; then
continue
fi
push_image "${image}"
done