From 9c3013bb241cfe0be2b85273d7dd370026f76237 Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Tue, 7 Apr 2026 02:17:18 +0200 Subject: [PATCH] Add cache clearing and auto-migrate to Docker entrypoint Clears config and application cache on every container start to prevent stale provider references after image updates. Creates the storage symlink and runs pending migrations if the app is already installed. Fixes #614 --- docker/production/entrypoint.d/00-setup.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker/production/entrypoint.d/00-setup.sh b/docker/production/entrypoint.d/00-setup.sh index 16096cfa..88dcdca8 100644 --- a/docker/production/entrypoint.d/00-setup.sh +++ b/docker/production/entrypoint.d/00-setup.sh @@ -45,3 +45,15 @@ if ! grep -q '^APP_KEY=[^[:space:]]' /var/www/html/.env; then echo "**** Generating new APP_KEY variable ****" ./artisan key:generate -n fi + +echo "**** Clearing cached config ****" +./artisan config:clear 2>/dev/null || true +./artisan cache:clear 2>/dev/null || true + +echo "**** Creating storage link ****" +./artisan storage:link --force 2>/dev/null || true + +echo "**** Running migrations (if app is installed) ****" +if ./artisan migrate:status > /dev/null 2>&1; then + ./artisan migrate --force +fi