-
Notifications
You must be signed in to change notification settings - Fork 0
/
local
51 lines (33 loc) · 1.36 KB
/
local
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
#!/bin/bash
################################################## ----- Variables ---- ################################################
LOCAL_DIR="local-compose"
# shellcheck source=$LOCAL_DIR/variables.sh
source "$LOCAL_DIR/variables.sh"
# shellcheck source=$LOCAL_DIR/functions.sh
source "$LOCAL_DIR/functions.sh"
################################################## ------- Func ------- ################################################
# will generate the build files used by the nginx container
function uiBuild() {
echo "starting $UI_CONTAINER build..."
cd .. || exit && sbt ui-build
}
function launchServices() {
echo "starting up services..."
cd $LOCAL_DIR || exit && $DOCKER_COMMAND up --build --force-recreate -d --remove-orphans
}
################################################## ------- Boot ------- ################################################
## parse args and move the cursor to read the subcommand (e.g. service name)
parseCommandLineOptions "$@" && shift $((OPTIND -1))
subCommand=$1
TAG=$(readCachedTag)
echo "project version: $TAG"
cd $LOCAL_DIR || exit
# defensive clean up
rm "$GENERATED_FILE" &> /dev/null
$DOCKER_COMMAND down &> /dev/null
SUBSTITUTION_PATTERNS="s/{tag}/$TAG/g"
generateDockerComposeFile "$SUBSTITUTION_PATTERNS"
# combine output in the same shell
{ uiBuild && launchServices; }
trap shutdown SIGINT
keepShellAlive "$subCommand"