forked from tinode/chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-release.sh
executable file
·68 lines (54 loc) · 1.42 KB
/
docker-release.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
61
62
63
64
65
66
67
68
#!/bin/bash
# Publish Tinode docker images
function containerName() {
if [ "$1" == "alldbs" ]; then
# For alldbs, container name is simply tinode.
local name="tinode"
else
# Otherwise, tinode-$dbtag.
local name="tinode-${dbtag}"
fi
echo $name
}
for line in $@; do
eval "$line"
done
tag=${tag#?}
if [ -z "$tag" ]; then
echo "Must provide tag as 'tag=v1.2.3' or 'v1.2.3-abc0'"
exit 1
fi
# Convert tag into a version
ver=( ${tag//./ } )
if [[ ${ver[2]} != *"-"* ]]; then
FULLRELEASE=1
fi
dbtags=( mysql mongodb rethinkdb alldbs )
# Read dockerhub login/password from a separate file
source .dockerhub
# Login to docker hub
docker login -u $user -p $pass
# Deploy images for various DB backends
for dbtag in "${dbtags[@]}"
do
name="$(containerName $dbtag)"
# Deploy tagged image
if [ -n "$FULLRELEASE" ]; then
docker push tinode/${name}:latest
docker push tinode/${name}:"${ver[0]}.${ver[1]}"
fi
docker push tinode/${name}:"${ver[0]}.${ver[1]}.${ver[2]}"
done
# Deploy chatbot images
if [ -n "$FULLRELEASE" ]; then
docker push tinode/chatbot:latest
docker push tinode/chatbot:"${ver[0]}.${ver[1]}"
fi
docker push tinode/chatbot:"${ver[0]}.${ver[1]}.${ver[2]}"
# Deploy exporter images
if [ -n "$FULLRELEASE" ]; then
docker push tinode/exporter:latest
docker push tinode/exporter:"${ver[0]}.${ver[1]}"
fi
docker push tinode/exporter:"${ver[0]}.${ver[1]}.${ver[2]}"
docker logout