From f22c7b4f593c7b950c0ec33f01d960b2956aa98f Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 28 Sep 2025 10:39:15 +0200 Subject: [PATCH 1/2] Increas start-period as first run might take a long time --- debian/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index e1eb1e9..f95eb63 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -92,7 +92,7 @@ COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh USER ${user} -HEALTHCHECK --start-period=10s CMD curl -f http://localhost/health +HEALTHCHECK --start-period=100s CMD curl -f http://localhost/health ENTRYPOINT ["/usr/local/bin/init.sh"] From 8899d3e956179da9c202169ad5db370a4592aef7 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 28 Sep 2025 10:39:29 +0200 Subject: [PATCH 2/2] optimize artisan commands --- debian/scripts/init.sh | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/debian/scripts/init.sh b/debian/scripts/init.sh index a6492ed..a587fd7 100755 --- a/debian/scripts/init.sh +++ b/debian/scripts/init.sh @@ -53,25 +53,24 @@ if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$ [ -d /app/storage/logs ] || mkdir -p /app/storage/logs if [ "$APP_ENV" = "production" ]; then + frankenphp php-cli artisan package:discover + frankenphp php-cli artisan migrate --force + frankenphp php-cli artisan cache:clear # Clear after the migration + frankenphp php-cli artisan ninja:design-update frankenphp php-cli artisan optimize - fi - frankenphp php-cli artisan package:discover + # If first IN run, it needs to be initialized + if [ "$(frankenphp php-cli artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then + echo "Running initialization..." - # Run migrations (if any) - frankenphp php-cli artisan migrate --force + frankenphp php-cli artisan db:seed --force - # If first IN run, it needs to be initialized - if [ "$(frankenphp php-cli artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then - echo "Running initialization..." - - frankenphp php-cli artisan db:seed --force - - if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then - frankenphp php-cli artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}" - else - echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env" - exit 1 + if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then + frankenphp php-cli artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}" + else + echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env" + exit 1 + fi fi fi