-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-local.sh
executable file
·55 lines (45 loc) · 1.04 KB
/
run-local.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
#!/bin/bash
declare dc_infra=infra/compose.dev.yaml
declare dc_app=infra/compose-app.dev.yaml
function build_app() {
cd ecommerce-monolith
./mvnw quarkus:image-build -DskipTests
cd ..
}
function start_infra() {
echo "Starting infra..."
docker-compose -f $dc_infra up -d
}
function stop_infra() {
echo "Stopping infra..."
docker-compose -f $dc_infra stop
}
function start() {
echo "Starting all services..."
build_app
docker-compose -f $dc_infra -f $dc_app up -d
docker-compose -f $dc_infra -f $dc_app logs -f
}
function stop() {
echo "Stopping all services..."
docker-compose -f $dc_infra -f $dc_app stop
docker-compose -f $dc_infra -f $dc_app rm -f
}
function restart() {
stop
sleep 5
start
}
action=start
if [ "$1" == "start" ]; then
action=start
elif [ "$1" == "stop" ]; then
action=stop
elif [ "$1" == "restart" ]; then
action=restart
elif [ "$1" == "start-infra" ]; then
action=start_infra
elif [ "$1" == "stop-infra" ]; then
action=stop_infra
fi
eval $action