-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.sh
executable file
·42 lines (33 loc) · 849 Bytes
/
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
#!/bin/bash
IMAGE=ethhmy-be
TAG=latest
NETWORK=
usage() {
me=$(basename "$0")
cat <<-EOT
Usage: this script is used to push docker image to dockerhub for release.
$me [options]
Options:
-h print this message
-n network network of the docker image (e.g. testnet/mainnet)
-t tag release tag of the docker image (default: $TAG)
EOT
exit 0
}
while getopts ':hn:t:' opt; do
case $opt in
n) NETWORK="$OPTARG";;
t) TAG="$OPTARG";;
*) usage ;;
esac
done
if [ -z "$TAG" -o -z "$NETWORK" ]; then
usage
fi
if [ "$NETWORK" == "mainnet" ]; then
sudo docker tag "$IMAGE" harmonyone/"$IMAGE":"$TAG"
sudo docker push harmonyone/"$IMAGE":"$TAG"
else
sudo docker tag "$IMAGE":"$NETWORK" harmonyone/"$IMAGE":"$TAG-$NETWORK"
sudo docker push harmonyone/"$IMAGE":"$TAG-$NETWORK"
fi