-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun
executable file
·81 lines (65 loc) · 1.79 KB
/
run
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
if ! [ -x "$(command -v docker)" ]; then
echo "⚠️ ${red}Error: Docker is required and not installed. Please install it before running this script.${reset}"
open 'https://www.docker.com/docker-mac'
exit 1
fi
COMPOSE="docker-compose"
RUN="${COMPOSE} run -u www-data --no-deps web"
EXEC="${COMPOSE} exec -u www-data web"
export IP="$(ifconfig | grep 'inet ' | grep -Fv 127.0.0.1 | awk '{print $2}')"
cd config
case "$1" in
"init")
../run build
../run update
;;
"build")
echo "🏁 ${green}Initializing Docker images${reset}"
${COMPOSE} pull
${COMPOSE} build
;;
"update")
if [ -f ../package.json ]; then
echo "📦 ${green}Updating Node dependencies from package.json${reset}"
${RUN} yarn
fi
if [ -f ../composer.json ]; then
echo "📦 ${green}Updating PHP dependencies from composer.json${reset}"
${RUN} composer update
fi
;;
"start")
echo "${green}Starting your Docker images${reset}"
${COMPOSE} up -d
echo "✅ Run ${green}./run watch${reset} to begin work!"
;;
"stop")
echo "🛑 ${red}Killing your Docker images${reset}"
${COMPOSE} down
;;
"logs")
${COMPOSE} logs
;;
"sync")
echo "☁️ ${green}Pulling assets and database from the remote server${reset}"
./scripts/pull_db.sh
./scripts/pull_assets.sh
;;
"watch")
open "http://${IP}.xip.io:3000"
${EXEC} yarn watch
;;
"production")
${EXEC} yarn build
;;
"lint")
${EXEC} yarn lint
;;
*)
${EXEC} "$@"
;;
esac