ci: cleanup build dirs; add web start script; fix NEXT_PUBLIC_CONVEX_URL usage

This commit is contained in:
Esdras Renan 2025-10-16 11:18:56 -03:00
parent 4724255e79
commit c785094e4f
3 changed files with 84 additions and 7 deletions

30
scripts/start-web.sh Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[start-web] Starting web service..."
echo "[start-web] Node: $(node -v || true)"
cd /app
# Ensure pnpm available in this base image
corepack enable >/dev/null 2>&1 || true
corepack prepare pnpm@9 --activate >/dev/null 2>&1 || true
echo "[start-web] Using APP_DIR=$(pwd)"
echo "[start-web] NEXT_PUBLIC_APP_URL=${NEXT_PUBLIC_APP_URL:-}"
echo "[start-web] NEXT_PUBLIC_CONVEX_URL=${NEXT_PUBLIC_CONVEX_URL:-}"
# Prisma generate (idempotent) and apply DB migrations
echo "[start-web] prisma generate"
pnpm prisma:generate
echo "[start-web] prisma migrate deploy"
pnpm exec prisma migrate deploy
# Seed Better Auth users safely (ensure-only by default)
echo "[start-web] seeding Better Auth users (ensure-only)"
pnpm auth:seed || true
echo "[start-web] launching Next.js"
exec pnpm start -p 3000