#!/bin/bash
# Build + restart dev server (standalone mode)
set -euo pipefail
cd "$(dirname "$0")"

echo "▶ Building..."
npm run build

echo "▶ Copying static files to standalone..."
cp -r .next/static .next/standalone/.next/static
cp -r public .next/standalone/public 2>/dev/null || true

echo "▶ Restarting PM2..."
pm2 restart tasteby-web

echo "✅ Done — http://localhost:3001"
