forked from MauroDataMapper/mdm-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·75 lines (59 loc) · 1.38 KB
/
update
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
#!/bin/bash
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-b|--backend-branch)
MDM_APPLICATION_BRANCH="$2"
shift # past argument
shift # past value
;;
-f|--frontend-branch)
MDM_UI_BRANCH="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
##################
# Functions
getDate(){
date +"%Y-%m-%d %H:%M:%S,%sZ"
}
outputLine(){
echo
eval printf '%.0s-' {1..$(tput cols)}
echo
}
##################
# Build Args
BUILD_ARGS="--build-arg CACHE_BURST=$(date +%s)"
if [ -n "$MDM_APPLICATION_BRANCH" ]
then
echo "Using backend branch $MDM_APPLICATION_BRANCH"
BUILD_ARGS="$BUILD_ARGS --build-arg MDM_APPLICATION_COMMIT=${MDM_APPLICATION_BRANCH}"
fi
if [ -n "$MDM_UI_BRANCH" ]
then
echo "Using frontend branch $MDM_UI_BRANCH"
BUILD_ARGS="$BUILD_ARGS --build-arg MDM_UI_COMMIT=${MDM_UI_BRANCH}"
fi
##################
set -e
outputLine
echo "Using docker >> $(docker --version) << [Required 19.03.0+]"
echo "Using docker-compose >> $(docker-compose -version) << [Recommended 1.27.0+]"
outputLine
echo "$(getDate) : Rebuilding docker compose"
echo
docker-compose build ${BUILD_ARGS}
outputLine
echo "$(getDate) : Restarting docker compose"
echo
docker-compose up -d