#!/bin/sh set -e # Ensure storage directories exist (for volume mounts) mkdir -p storage/framework/views \ storage/framework/cache \ storage/framework/sessions \ storage/logs \ storage/app/public # Recreate symlink (lost on empty volume) if [ ! -L public/storage ]; then ln -sf ../storage/app/public public/storage fi # Ensure writable chmod -R 775 storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cache # Create missing DB tables (sessions, cache) without breaking existing data php /app/docker/ensure-tables.php 2>/dev/null || true exec "$@"