This repository has been archived by the owner on May 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_build.sh
72 lines (55 loc) · 2 KB
/
main_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
#! /bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
echo $SCRIPT_DIR
###===== read from config file
echo ==1==. Read the configure file
if [[ $1 == "dev" ]]
then
configfile=$SCRIPT_DIR/main_config_dev.cnf
else
if [[ $1 == "prod" ]]
then
configfile=$SCRIPT_DIR/main_config_prod.cnf
else
echo "Please choose the env is dev/prod"
exit
fi
fi
echo $configfile
keys=( $(grep -oP '\w+(?==)' "$configfile") )
. "$configfile"
### confirm build daita
read -p "Do you want to build DAITA [Y/n]: " IS_BUILD_DAITA
confirm=${IS_BUILD_DAITA:-y}
read -p "Do you want to build ANNOTATION [Y/n]: " IS_BUILD_ANNOTATION
confirm=${IS_BUILD_ANNOTATION:-y}
for var in "${keys[@]}"; do
printf "%s\t=> %s\n" "$var" "${!var}"
done
### confirm the config again
read -p "Are you sure that you want to continue with this configuration [y/N]: " confirm
confirm=${confirm:-n}
if [[ $confirm == "n" ]] || [[ $confirm == "N" ]]
then
exit
fi
### output data path
output_data=$SCRIPT_DIR/$OUTPUT_BUILD_DAITA_NAME
output_fe_config=$SCRIPT_DIR/$OUTPUT_FOR_FE
### save FE config
echo "### config for daita_env: $DAITA_STAGE annotation_env: $ANNOTATION_STAGE ###" > $output_fe_config
echo "REACT_APP_ENV=development" >> $output_fe_config
### build infrastructure that use for another application
echo ==============Building: INFRA ==========================
bash ./infrastructure-def-app/build_infra_app.sh "$configfile" "$output_data" "$output_fe_config"
### build daita app and annotation ap
if [[ $IS_BUILD_DAITA == "y" ]] || [[ $IS_BUILD_DAITA == "Y" ]]
then
echo ==============Building: DAITA ==========================
bash ./daita-app/build_daita.sh "$configfile" "$output_data" "$output_fe_config"
fi
if [[ $IS_BUILD_ANNOTATION == "y" ]] || [[ $IS_BUILD_ANNOTATION == "Y" ]]
then
echo ==============Building: ANNOTATION ==========================
bash ./annotation-app/build_annotation.sh "$configfile" "$output_data" "$output_fe_config"
fi