paneln8n/docker/templates/entrypoint.sh
2025-09-11 23:01:21 +02:00

62 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -e
echo -e "Start or what"
function wait_service {
echo -e "Waiting service $1, $2..."
while ! nc -z $1 $2; do
exec sleep 1
done
}
function create_backpack_authjson {
echo -e "Creating auth.json for the Backpack component"
if [[ ! -f auth.json ]];
then
echo -e "No auth.json, creating one..."
composer config http-basic.backpackforlaravel.com $BACKPACK_LICENSE_EMAIL $BACKPACK_LICENSE_KEY
fi
}
function install_composer_dependencies {
echo -e "Installing composer dependencies..."
if [[ ! -d vendor ]];
then
echo -e "No vendor, installing..."
composer install
fi
}
function laravel_migrate {
echo -e "Laravel migrations..."
php artisan migrate:fresh --seed 2>&1
}
function laravel_bootstrap {
echo -e "Create laravel keys and clearing cache..."
# Create laravel encryption key if it is not present on the file
if ! grep -Eq 'APP_KEY=.{50}' .env; then
php artisan key:generate
php artisan cache:clear
fi
}
case $1 in
run-server)
echo -e "Run server..."
wait_service $MYSQL_HOST $MYSQL_PORT
cd /code
#create_backpack_authjson
install_composer_dependencies
# laravel_migrate
laravel_bootstrap
exec php artisan serve --host=0.0.0.0 --port=$VPORT
;;
*)
exec "$@"
;;
esac