-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·60 lines (47 loc) · 1.17 KB
/
build.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
#!/bin/bash
projectArray=(rabbit-sender rabbit-receiver)
projectVersion=v1
function note() {
local GREEN NC
GREEN='\033[0;32m'
NC='\033[0m' # No Color
printf "\n${GREEN}$@ ${NC}\n" >&2
}
set -e
if [[ $@ == *"compile"* ]]
then
for project in ${projectArray[*]}; do
note "Compiling $project..."
cd $project; mvn clean install; docker build -f docker/Dockerfile -t $project:$projectVersion .; cd -
done
fi
if [[ $@ == *"start-d9"* ]]
then
note "Starting docker compose"
docker compose up --build -d
fi
if [[ $@ == *"stop-d9"* ]]
then
note "Stopping docker compose"
docker compose down
fi
if [[ $@ == *"start-k8"* ]]
then
# eval $(minikube docker-env)
note "Starting building yaml files..."
note "Starting Rabbitmq Server..."
kubectl apply -f kubernetes/rabbitmq.yaml; sleep 3
for project in ${projectArray[*]}; do
note "Starting $project..."
kubectl apply -f kubernetes/$project.yaml; sleep 5
done
fi
if [[ $@ == *"stop-k8"* ]]
then
note "Stoping kubernetes..."
kubectl delete service rabbitmq
kubectl delete deployment rabbitmq
kubectl delete service ${projectArray[*]}
kubectl delete deployment ${projectArray[*]}
fi
#