This repository has been archived by the owner on Aug 13, 2022. It is now read-only.
forked from Kipjr/docker-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
75 lines (68 loc) · 1.67 KB
/
entrypoint.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
cd /var/www/laravel/
setup () {
if [ -d './app' ]; then
if [[ $(ls ./app | wc -l) < 1 ]]; then
git clone $APP_REPO app
cd /var/www/laravel/app
git checkout $APP_REPO_BRANCH
cp .env.example .env
echo -e "\nNow in $PWD: \n$(ls -laA)\n\nEdit the .env file and run 'init'\n"
else
echo "folder ./app not empty.. unable to setup.. running init instead"
init
fi
else
echo "use docker-compose with volume './app:/var/www/laravel/app' "
fi
}
init () {
cd /var/www/laravel/app
if [ -f .env ]; then
if [ $(diff .env .env.example | wc -l) > 0 ]; then
php ../composer.phar update
php ../composer.phar install
php artisan key:generate #needs .env
echo "starting application"
run
else
echo ".env not changed"
fi
else
echo ".env missing"
fi
}
run () {
cd /var/www/laravel/app
if [[ -f .env ]]; then
if [[ $(diff .env .env.example | wc -l) > 0 ]]; then
php artisan config:cache
php artisan migrate
php artisan serve --port=8080 --host=app
else
echo ".env not changed"
fi
else
echo ".env missing"
fi
}
if [ "$1" = 'init' ]; then
init
elif [ "$1" = 'setup' ]; then
REPO=$2
BRANCH=$3
setup
elif [ "$1" = 'run' ]; then
run
elif [ "$1" = 'composer' ]; then
cd /var/www/laravel/app
php ../composer.phar "${@:(2):(-1)}"
elif [ "$1" = 'artisan' ]; then
cd /var/www/laravel/app
php artisan "${@:(2):(-1)}"
elif [ "$1" = 'git' ]; then
cd /var/www/laravel/app
git "${@:(2):(-1)}"
else
echo "Not sure what to do; k tnx bye"
fi