forked from Azuriom/Azuriom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azuriom.sh
executable file
·105 lines (86 loc) · 2.76 KB
/
azuriom.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
SCRIPT=$(realpath "$0")
SCRIPT_DIR=$(dirname "$SCRIPT")
cd "${SCRIPT_DIR}" || exit
case $1 in
"build")
bash "$0" composer-install
bash "$0" npm-install
bash "$0" npm-run-prod
bash "$0" laravel-symlink
docker-compose build
exit
;;
"start")
docker-compose up -d
exit
;;
"stop")
docker-compose stop
exit
;;
"docker-compose-build")
docker-compose build
exit
;;
"npm-install")
docker run -it --rm -v "${SCRIPT_DIR}":/usr/src/app -w /usr/src/app node:18 npm ci
exit
;;
"npm-run-prod")
docker run -it --rm -v "${SCRIPT_DIR}":/usr/src/app -w /usr/src/app node:18 npm run prod
exit
;;
"composer-install")
docker run --rm --interactive --tty --volume "${SCRIPT_DIR}":/app composer install
exit
;;
"laravel-generate-key")
docker-compose exec php-fpm php artisan key:generate
exit
;;
"laravel-init-db")
docker-compose exec php-fpm php artisan migrate --seed
exit
;;
"laravel-migrate")
docker-compose exec php-fpm php artisan migrate
exit
;;
"laravel-symlink")
docker-compose exec php-fpm php artisan storage:link
exit
;;
"laravel-create-admin")
docker-compose exec php-fpm php artisan user:create --admin
exit
;;
"laravel-clear-cache")
docker-compose exec php-fpm php artisan cache:clear
exit
;;
"artisan")
shift
docker-compose exec php-fpm php artisan "$*"
exit
;;
esac
# Display Help
echo "Manage Azuriom using docker and docker-compose. See https://github.com/Azuriom/Azuriom/blob/master/docker/INSTALL.md"
echo
echo "Usage: ./azuriom.sh COMMAND [arguments]"
echo
echo "Commands:"
echo " build Build the whole application."
echo " start Start containers (require the whole application to be built)"
echo " docker-compose-build Build containers"
echo " npm-install Install npm dependencies"
echo " npm-run-prod Compile assets (require npm dependencies to be installed)"
echo " composer-install Install composer dependencies"
echo " laravel-generate-key Generate laravel APP_KEY in .env file (used by laravel for data encryption)"
echo " laravel-init-db Initiate database"
echo " laravel-migrate Run migration (mostly used when updating to insert database changes)"
echo " laravel-symlink Create a symlink (create a symlink public/storage -> storage/app/public)"
echo " laravel-create-admin Create an admin user through CLI"
echo " laravel-clear-cache Clear laravel cache"
echo " artisan <commands> Run any artisan command (e.g. ./azuriom artisan cache:clear)"