-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·57 lines (43 loc) · 1.37 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
# Script to preapre the build environment for the projec
# Check if the user is root
if [ "$EUID" -ne 0 ]
then printf "Please run as root\n"
exit
fi
printf "Importent notice be sure to change the required configuration files"
printf "before running the build script\n\n"
printf "More information about config files can be found in the readme\n"
# Check if docker is installed
if ! [ -x "$(command -v docker)" ]; then
printf "Docker is not installed\n"
exit
fi
# Check if docker-compose is installed
if ! [ -x "$(command -v docker-compose)" ]; then
if ! [ -x "$(command -v docker compose)" ]; then
printf "Docker-compose is not installed\n"
exit
fi
fi
# Check if git is installed
if ! [ -x "$(command -v git)" ]; then
printf "Git is not installed\n"
exit
fi
## Ask the user if he wants to continue
read -p "Do you want to continue? [y/n]" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit
fi
printf "Preparing the build environment for the project\n"
# Clone the required repositories for the project
git clone https://github.com/Pereira-Luc/AnomolyServer
# Ask the user for a Secret key for the project
read -p "Please enter a secret key for the project: " secret_key
echo
# Modify the .env file for the project
sed -i "s/APP_SECRET=.*/APP_SECRET=\""$secret_key"\"/g" AnomolyServer/.env
# Run docker-compose to build the project
docker-compose up -d --build