-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev.sh
52 lines (39 loc) · 1.15 KB
/
dev.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
#!/bin/bash
trap ctrl_c INT
function run() {
docker compose --env-file ./.env up -d
docker compose logs -t -f app-supplier app-store app-documentation
}
function prompt_for_install_docker() {
read -p "Do you want to install Docker? (yes/no) " ans
if [[ $ans == 'yes' || $ans == 'no' ]];
then
return $([ $ans == 'yes' ])
else
request_for_install_docker
fi
}
function install_docker() {
[ $USER != 'root' ] && echo "run script with sudo command" && exit 0
curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
sh /tmp/get-docker.sh
rm /tmp/get-docker.sh
return 1
}
function fix_permissions() {
sudo groupadd docker
sudo usermod -aG docker $(logname)
sudo chown "$(logname)":"$(logname)" /home/$(logname)/.docker -R
sudo chmod g+rwx "/home/$(logname)/.docker" -R
su $(logname)
}
function is_docker_installed() {
return $([ ! -z $(which docker) ])
}
function ctrl_c() {
echo 'Shutting Down Services'
docker compose --env-file ./.env down
exit 0
}
! is_docker_installed && prompt_for_install_docker === 'yes' && install_docker
is_docker_installed && run