-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp
executable file
·65 lines (58 loc) · 1.76 KB
/
app
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
#!/bin/sh
help="app script for local deployment
Available commands:
${LBLUE}start${NC} run the project
${LBLUE}stop${NC} stop all project's containers
${LBLUE}restart${NC} restart all project's containers
${LBLUE}recreate${NC} recreate all project's containers
${LBLUE}shell${NC} enter PHP container's shell
${LBLUE}php${NC} run PHP commands
${LBLUE}phpunit${NC} run PHP Unit bridge commands
${LBLUE}composer${NC} run Composer commands
${LBLUE}console${NC} run Symfony console commands"
action="${1}"
os=`uname`
appDir=$(CDPATH= cd -- "$(dirname -- "${0}")" && pwd)
runDir=$appDir/docker
container_php=jb_notificator_php
dir=notificator
cd "${appDir}"
if [ ! -d "vendor" ]; then
echo "Creating vendor dir before starting."
mkdir "vendor"
fi
if [ ! -d "var" ]; then
echo "Creating var dir before starting."
mkdir "var"
fi
cd "${runDir}"
export UID=$(id -u)
export GID=$(id -g)
case "$action" in
start )
eval "docker-compose up -d" ;;
stop )
eval "docker-compose stop" ;;
restart )
eval "docker-compose stop && docker-compose up -d" ;;
recreate )
eval "docker-compose stop && docker-compose up -d --force-recreate" ;;
shell )
eval "docker exec -it -u ${UID} ${container_php} sh" ;;
php )
shift
eval "docker exec -it -u ${UID} -w /var/www/${dir} ${container_php} php ${@}" ;;
phpunit )
shift
eval "docker exec --env-file ../.env.test -it -u ${UID} -w /var/www/${dir} ${container_php} \
php vendor/bin/simple-phpunit --testdox ${@}" ;;
composer )
shift
eval "docker exec -it -u ${UID} -w /var/www/${dir} ${container_php} php bin/composer ${@}" ;;
console )
shift
eval "docker exec -it -u ${UID} -w /var/www/${dir} ${container_php} bin/console ${@}" ;;
* )
echo "${help}" ;;
esac
return 0