diff --git a/deploy/docker-entrypoint.sh b/deploy/docker-entrypoint.sh index d1a8671..8584af1 100644 --- a/deploy/docker-entrypoint.sh +++ b/deploy/docker-entrypoint.sh @@ -62,12 +62,22 @@ log "Wrote nginx config -> $NGINX_CONF_OUT" # final sanity test against active config tree nginx -t || die "nginx config test failed after install" -# -------- Laravel cache clears (best-effort) -------- +# -------- Laravel setup -------- if [ -f "$APP_DIR/artisan" ]; then + log "Setting up Laravel application" + + # Ensure cache directories exist with proper permissions + mkdir -p "$APP_DIR/storage/framework/cache/data" "$APP_DIR/bootstrap/cache" + chmod -R 775 "$APP_DIR/storage" "$APP_DIR/bootstrap/cache" 2>/dev/null || true + + # Run database migrations + log "Running database migrations" + ( cd "$APP_DIR" && php artisan migrate --force 2>&1 || log "migrations failed (continuing)" ) | head -10 + + # Clear caches (use file driver to avoid DB dependency during startup) log "Clearing Laravel caches" - # Use file cache driver during startup to avoid DB dependency - ( cd "$APP_DIR" && CACHE_STORE=file php artisan config:clear || log "config:clear failed (continuing)" ) - ( cd "$APP_DIR" && CACHE_STORE=file php artisan cache:clear || log "cache:clear failed (continuing)" ) + ( cd "$APP_DIR" && CACHE_STORE=file php artisan config:clear 2>&1 || log "config:clear failed (continuing)" ) | head -5 + ( cd "$APP_DIR" && CACHE_STORE=file php artisan cache:clear 2>&1 || log "cache:clear failed (continuing)" ) | head -5 else log "No Laravel app at $APP_DIR; skipping artisan" fi