-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
107 lines (86 loc) · 2.54 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
do_log() {
echo "==============================================================================="
echo "$1"
echo "==============================================================================="
}
proj_build_status() {
case $1 in
'events-api') echo 'true';;
'stats-api') echo 'true';;
'engine') echo 'true';;
'feeder') echo 'true';;
*) echo 'true'
esac
}
skip_build_project=false
do_clean=true
skip_tests=true
build_base_java_image=true
compose_hide_logs="kafka,zookeeper"
# ///////////////////// BUILD PROJECT ////////////////////////////////////
if [ "$skip_build_project" != "true" ]; then
MVN_ARGS=""
if [ "$do_clean" == "true" ]; then
MVN_ARGS+="clean"
fi
MVN_ARGS+=" install "
if [ "$skip_tests" == "true" ]; then
MVN_ARGS+=" -DskipTests "
fi
do_log "⚙️ Building Oasis..."
mvn $MVN_ARGS
else
echo "🔸 Skipped: Building maven project"
fi
# ///////////////////// BUILD DOCKER IMAGES ////////////////////////////////////
do_log "🚢 Creating Containers..."
if [ "$build_base_java_image" == "true" ]; then
do_log "🛠️ Build the base java image"
docker build -t oasis/base-java -f ./buildscripts/docker/base-java.dockerfile .
else
echo "🔸 Skipped: Building base java image"
fi
cp externals/kafka-stream/target/libs/* buildscripts/modules
cp externals/kafka-stream/target/oasis-ext-kafkastream.jar buildscripts/modules
if [ "$(proj_build_status events-api)" == "true" ]; then
do_log "🛠️ Building Events API Docker Image..."
cd services/events-api || exit 1
docker build -t oasis/events-api .
cd ../..
else
echo "🔸 Skipped: Building events-api"
fi
if [ "$(proj_build_status stats-api)" == "true" ]; then
do_log "🛠️ Building Admin/Stats API Docker Image..."
cd services/stats-api || exit 1
docker build -t oasis/stats-api .
cd ../..
else
echo "🔸 Skipped: Building stats-api"
fi
if [ "$(proj_build_status feeder)" == "true" ]; then
do_log "🛠️ Building Feeder Docker Image..."
cd services/feeder || exit 1
docker build -t oasis/feeder .
cd ../..
else
echo "🔸 Skipped: Building feeder"
fi
if [ "$(proj_build_status engine)" == "true" ]; then
do_log "🛠️ Building Engine Docker Image..."
cd engine || exit 1
docker build -t oasis/engine .
cd ..
else
echo "🔸 Skipped: Building engine"
fi
mkdir -p .tmpdata/enginedb
mkdir -p .tmpdata/cache
do_log "📣 Starting Oasis..."
IFS=',' read -ra LOGS <<< "$compose_hide_logs"
args_logs=""
for log in "${LOGS[@]}"; do
args_logs+="--no-attach $log "
done
docker compose up $args_logs