#!/bin/sh # Create .storage directories if they don't exist (as root) mkdir -p /app/.storage/users mkdir -p /app/.storage/bookings mkdir -p /app/.storage/treatments mkdir -p /app/.storage/availability mkdir -p /app/.storage/cancellation-tokens # Change ownership to nextjs user chown -R nextjs:nodejs /app/.storage # Ensure runtime dependencies exist (for prebuilt images) if [ ! -d "/app/node_modules/hono" ]; then echo "[startup] Installing runtime dependencies (prebuilt safeguard)..." pnpm install --frozen-lockfile --prod --ignore-scripts=false || pnpm install --prod || true pnpm rebuild bcrypt || true fi # Start the application as nextjs user exec su-exec nextjs node server-dist/index.js