#!/bin/sh set -eu cd /var/www/html || exit 1 # Ensure Laravel dirs exist (idempotent) mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache # Fix perms (in case volumes are mounted) chown -R nginx:nginx storage bootstrap/cache || true chmod -R ug+rwX storage bootstrap/cache || true # If Laravel present: clear stale build-stage caches pointing to /app, then warm new caches if [ -f artisan ]; then php artisan config:clear --no-ansi || true php artisan cache:clear --no-ansi || true php artisan route:clear --no-ansi || true php artisan view:clear --no-ansi || true # Optional: warm fresh caches in runtime path php artisan config:cache --no-ansi || true php artisan route:cache --no-ansi || true php artisan view:cache --no-ansi || true fi exit 0