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
This commit is contained in:
Darko Gjorgjijoski
2026-04-07 02:17:18 +02:00
parent 5efd1054f4
commit 9c3013bb24

View File

@@ -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