-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy.sh
48 lines (38 loc) · 1.4 KB
/
deploy.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
# echo in violet
echo -e '\e[1;35m'
cat << "EOF"
###### ####### __ __
# # ###### ## ##### # #### / \.-"""-./ \
# # # # # # # # # \ - - /
###### ##### # # # # # #### | o o |
# # # ###### ##### # # \ .-'''-. /
# # # # # # # # # # '-\__Y__/-'
###### ###### # # # # # #### `---`
____ _ _ _ _ ____ ____ ____ _ ___ ___
|__/ | | |\ | [__ | |__/ | |__] |
| \ |__| | \| ___] |___ | \ | | |
EOF
echo -e '\e[0m'
# check if docker is installed
if ! [ -x "$(command -v docker)" ]; then
echo 'Error: docker is not installed.' >&2
echo 'Installing Docker' >&2
sudo apt-get update
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker $USER
sudo apt-get install docker-compose-plugin
echo -e '\e[1;33m Please restart your terminal and run the script again \e[0m'
exit 1
fi
echo -e '\e[1;32m Starting server \e[0m'
echo -e '\e[1;32m Building docker images \e[0m'
docker compose build
echo -e '\e[1;32m Getting containers up \e[0m'
docker compose up -d
if [ $? -ne 0 ]; then
echo -e '\e[1;31m Error: docker compose up failed \e[0m'
exit 1
fi
echo -e '\e[1;32m Server started \e[0m'
exit 0