Docker-Runit/laravel/laravel.runit
2023-05-15 00:06:08 +02:00

34 lines
1,013 B
Bash

#!/usr/bin/env bash
rm -f /var/lock/laravel_ready
echo "[LARAVEL-FIXER] Fixing laravel application permissions"
mkdir -p /app/storage /app/bootstrap/cache
find /app/storage -type d -exec chmod 777 {} \;
find /app/bootstrap/cache -type d -exec chmod 777 {} \;
find /app/storage -type f -not -name ".gitignore" -exec chmod 666 {} \;
find /app/bootstrap/cache -type f -exec chmod 666 {} \;
touch /app/storage/logs/laravel.log
chmod 777 -R /app/storage
chmod +x /app/artisan
php artisan package:discover
if [ "${REGENERATE_KEYS,,}" = "on" ]; then
php artisan key:generate
php artisan passport:keys --force
fi
echo "[LARAVEL-FIXER] Waiting for mysql..."
/usr/bin/wait-for-mysql
echo "[LARAVEL-FIXER] Mysql Ready, Laravel Ready."
php artisan wipe
touch /var/lock/laravel_ready
# Output the laravel log to the docker terminal.
tail -n0 -f /app/storage/logs/laravel-*.log /app/storage/logs/laravel.log &
# Sleep forever (and sleep again incase the sleep process is killed)
while true; do
sleep infinity
done