-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcruise
55 lines (49 loc) · 1.78 KB
/
cruise
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
#!/bin/bash
if [ ! -f ".env" ]; then
echo ".env file is missing!"
exit 1
fi
loadEnv() {
(set -a && . ./.env && "$@")
}
directory="$(dirname -- "$( readlink -f -- "$0" || greadlink -f -- "$0"; )")";
if grep -qF "WORKING_DIR=" "$directory/.env"; then
existing=$(grep "WORKING_DIR=" "$directory/.env" | cut -d '=' -f 2)
if [ -z "$existing" ]; then
sed -i "s|WORKING_DIR=.*|WORKING_DIR=$directory|" "$directory/.env"
fi
else
printf "\nWORKING_DIR=%s" "$directory" >> "$directory/.env"
fi
find "${directory}/configuration/apache/" -type f -name "*.conf" -exec cp -ua {} "${directory}/docker/conf/docker-files/apache/" \;
if [ ! -f "${directory}/configuration/php/php.ini" ]; then
touch "${directory}/configuration/php/php.ini"
fi
case "$1" in
up)
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml up
;;
start | reload)
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml up -d
;;
stop | down)
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml down
;;
reboot | restart)
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml down
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml up -d
;;
rebuild)
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml down
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml build --no-cache --pull $2 $3 $4 $5 $6 $7 $8 $9
;;
core)
docker exec -it Core bash -c "sudo -u devuser /bin/bash"
;;
lzd)
docker exec -it SERVER_TOOLS lazydocker
;;
*)
docker compose --project-directory "$directory" -f docker/compose/docker-compose.yml $@
;;
esac