-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrun.sh
executable file
·58 lines (46 loc) · 1.21 KB
/
run.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
#!/bin/bash
declare dc_file=deployment/docker-compose/docker-compose.yml
function build_apps_buildpacks() {
./mvnw -pl techbuzz clean spring-boot:build-image -Dspring-boot.build-image.imageName=sivaprasadreddy/techbuzz
}
function build_apps() {
./mvnw -pl techbuzz spotless:apply
build_apps_buildpacks
}
function start_infra() {
echo "Starting dependent docker containers...."
docker-compose -f "${dc_file}" up --build --force-recreate -d
docker-compose -f "${dc_file}" logs -f
}
function stop_infra() {
echo "Stopping dependent docker containers...."
docker-compose -f "${dc_file}" stop
docker-compose -f "${dc_file}" rm -f
}
function restart_infra() {
stop_infra
sleep 5
start_infra
}
function start() {
echo "Starting app...."
build_apps
docker-compose --profile app -f "${dc_file}" up --build --force-recreate -d
docker-compose --profile app -f "${dc_file}" logs -f
}
function stop() {
echo 'Stopping app....'
docker-compose --profile app -f "${dc_file}" stop
docker-compose --profile app -f "${dc_file}" rm -f
}
function restart() {
stop
sleep 3
start
}
action="start"
if [[ "$#" != "0" ]]
then
action=$*
fi
eval "${action}"