-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpush.sh
executable file
·45 lines (40 loc) · 1.1 KB
/
push.sh
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
#!/bin/bash
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
source .env
function usage(){
echo ""
echo "Usage: $0 [arg] - push one or more images to the configured registry"
echo ""
echo " arg:"
echo ""
echo " '' - push the latest build image only"
echo " ls - list available images to push"
echo " all - push all project images"
echo " image - push specified image"
echo ""
}
if [ "$1" == "--help" ]; then
usage
exit 0
fi
if [ "$1" == "" ]; then
docker image push ${REGISTRY}${IMAGE}${TAG}
else
case "$1" in
"ls")
docker images | grep $IMAGE_NAME | grep $REGISTRY | grep $VERSION
;;
"all")
IMAGES=$(docker images | grep $IMAGE_NAME | grep $REGISTRY | grep $VERSION | cut -d ' ' -f 1)
for IMG in $IMAGES; do
docker push ${IMG}${TAG}
done
;;
*)
docker push ${1}${TAG}
;;
esac
fi