-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp-compose.sh
executable file
·31 lines (28 loc) · 1.02 KB
/
app-compose.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
#!/bin/bash
# ./app-compose.sh <option>[--start|--destroy]
OPTION=$1
echo "IP_HOST_API=$(hostname -I | cut -d" " -f1)" > ./.env
ENVFILE=$PWD/.env
if [ ! -s "$ENVFILE" ]; then
echo "File .env does not exist or is empty!"; exit
fi
case $OPTION in
"--start")
echo -e '🐳 Building containers ...'
docker-compose build > /dev/null
echo -e '🐳 Starting containers ...'
docker-compose up -d > /dev/null
echo -e '🚀 container started successfully!'
echo "🕒 Initilize API Provision ... "
bash start-api.sh
;;
"--destroy")
echo -e '🔴 Destroying containers and images ...'
docker-compose down --rmi all
echo "" > .env
echo -e '🤝 Finished environment ...'
;;
*)
echo "Not a valid argument!"
echo "excution example: ./app-compose.sh <option>[--start|--destroy]"
esac