Fix Laravel APP_KEY handling in Docker

Export the generated Laravel app key before starting Apache so deployments without an explicit APP_KEY do not fail with a 500 MissingAppKeyException.
This commit is contained in:
Power BI Dev
2026-05-03 19:20:28 +07:00
parent e8ce31c216
commit 9a3849c04f
3 changed files with 7 additions and 2 deletions

View File

@@ -46,6 +46,11 @@ if [ -z "$(grep '^APP_KEY=base64:' .env || true)" ]; then
php artisan key:generate --force
fi
APP_KEY_VALUE="$(grep '^APP_KEY=' .env | tail -n 1 | cut -d '=' -f 2-)"
if [ -n "$APP_KEY_VALUE" ]; then
export APP_KEY="$APP_KEY_VALUE"
fi
php artisan optimize:clear || true
php artisan config:cache || true
php artisan route:cache || true