#!/usr/bin/env bash set -euo pipefail cd "$(dirname "$0")/.." # Prevent path leakage between host Nuxt build cache and Docker runtime. # If any cache contains absolute /Users/... imports, Nitro dev runtime can break in /app. mkdir -p .nuxt .output find .nuxt -mindepth 1 -maxdepth 1 -exec rm -rf {} + || true find .output -mindepth 1 -maxdepth 1 -exec rm -rf {} + || true rm -rf node_modules/.cache node_modules/.vite # Install deps (container starts from a clean image). # Fallback to npm install when lockfile was produced by a newer npm major. if ! npm ci; then npm install fi # DB path used by DATABASE_URL="file:../../.data/clientsflow-dev.db" from /app/Frontend DB_FILE="/app/.data/clientsflow-dev.db" # First boot: create schema + seed. # Next boots: keep data, only sync schema and re-run idempotent seed. if [[ ! -f "$DB_FILE" ]]; then npx prisma db push --force-reset else npx prisma db push fi node prisma/seed.mjs exec npm run dev -- --host 0.0.0.0 --port 3000