forked from medianetlab/katana-slice_manager
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpush_docker_image.sh
executable file
·60 lines (52 loc) · 1.69 KB
/
push_docker_image.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Push docker images to docker hub
# *** Docker Login ***
# Check the options to see if user and password are defined
while [[ $# -gt 0 ]]
do
key=$1
case $key in
-p | --password)
DOCKER_PASSWORD=$2
shift
shift
;;
-u | --user)
DOCKER_USER=$2
shift
shift
;;
-r | --release)
TAG_NUMBER=$2
shift
shift
;;
*)
printf "Wrong option %s\n--------\n" "${key}"
exit 9999
;;
esac
done
# Read the user and password if they are not given as options
if [ -z "${DOCKER_PASSWORD+x}" ] || [ -z "${DOCKER_USER+x}" ]; then
read -r -p "Enter the Docker hub user" DOCKER_USER
read -r -p -s "Enter the password " DOCKER_PASSWORD
fi
docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}"
# Push to the remote Docker Hub
if [ -z "${TAG_RELEASE+x}" ]; then
docker image push "${DOCKER_USER}"/katana-nbi:"${TAG_NUMBER}"
docker image push "${DOCKER_USER}"/katana-mngr:"${TAG_NUMBER}"
docker image push "${DOCKER_USER}"/katana-cli:"${TAG_NUMBER}"
docker image push "${DOCKER_USER}"/katana-swagger:"${TAG_NUMBER}"
docker image push "${DOCKER_USER}"/katana-prometheus:"${TAG_NUMBER}"
docker image push "${DOCKER_USER}"/katana-grafana:"${TAG_NUMBER}"
docker image push "${DOCKER_USER}"/katana-nfv_mon:"${TAG_NUMBER}"
fi
docker image push "${DOCKER_USER}"/katana-nbi:latest
docker image push "${DOCKER_USER}"/katana-mngr:latest
docker image push "${DOCKER_USER}"/katana-cli:latest
docker image push "${DOCKER_USER}"/katana-swagger:latest
docker image push "${DOCKER_USER}"/katana-prometheus:latest
docker image push "${DOCKER_USER}"/katana-grafana:latest
docker image push "${DOCKER_USER}"/katana-nfv_mon:latest