-
Notifications
You must be signed in to change notification settings - Fork 2
/
deployimage.sh
executable file
·77 lines (52 loc) · 1.25 KB
/
deployimage.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
69
70
71
72
73
74
75
76
77
#!/bin/sh
echo
echo "Building sapindale:latest"
docker build -f Dockerfile.prod -t sapindale:latest .
if [ "$?" -ne "0" ]; then
exit $?
fi
docker login docker.c7a.ca
if [ "$?" -ne "0" ]; then
echo
echo "Error logging into the c7a Docker registry."
exit 1
fi
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [ "${BRANCH}" = "main" ]; then
IMAGEEXT="";
else
IMAGEEXT="-${BRANCH}"
fi
TAG=`date -u +"%Y%m%d%H%M%S"`
DISTIMAGE="docker.c7a.ca/sapindale${IMAGEEXT}:$TAG"
DISTLATEST="docker.c7a.ca/sapindale:latest"
echo
echo "Tagging sapindale:latest as $DISTLATEST"
docker tag sapindale:latest $DISTLATEST
if [ "$?" -ne "0" ]; then
exit $?
fi
echo
echo "Pushing $DISTLATEST"
docker push $DISTLATEST
if [ "$?" -ne "0" ]; then
exit $?
fi
echo
echo "Tagging sapindale:latest as $DISTIMAGE"
docker tag sapindale:latest $DISTIMAGE
if [ "$?" -ne "0" ]; then
exit $?
fi
echo
echo "Pushing $DISTIMAGE"
docker push $DISTIMAGE
if [ "$?" -ne "0" ]; then
exit $?
fi
echo
echo "Push sucessful. Create a new issue at:"
echo
echo "https://github.com/crkn-rcdr/Systems-Administration/issues/new?title=New+Sapindale+image:+%60$DISTIMAGE%60&body=Please+describe+the+changes+in+this+update%2e"
echo
echo "to alert the systems team. Don't forget to describe what's new!"