forked from cortexproject/cortex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
push-images
executable file
·52 lines (43 loc) · 976 Bytes
/
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
#!/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"
echo "Pushing ${image}:${IMAGE_TAG}"
docker 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}
docker tag ${image}:${IMAGE_TAG} ${docker_hub_image}:${IMAGE_TAG}
echo "Pushing ${docker_hub_image}:${IMAGE_TAG}"
docker push ${docker_hub_image}:${IMAGE_TAG}
}
for image in ${IMAGES}; do
if [[ "$image" == *"build"* ]]; then
continue
fi
push_image "${image}"
done