Update chat events/transcription flow and container startup fixes
This commit is contained in:
@@ -11,22 +11,32 @@ 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
|
||||
# npm ci is unstable in this workspace due lock drift in transitive deps.
|
||||
npm install
|
||||
|
||||
# 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
|
||||
# sharp is a native module and can break when cached node_modules were installed
|
||||
# for a different CPU variant (for example arm64v8). Force a local rebuild.
|
||||
ARCH="$(uname -m)"
|
||||
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
npm rebuild sharp --platform=linux --arch=arm64v8 \
|
||||
|| npm rebuild sharp --platform=linux --arch=arm64 \
|
||||
|| npm install sharp --platform=linux --arch=arm64v8 --save-exact=false \
|
||||
|| npm install sharp --platform=linux --arch=arm64 --save-exact=false
|
||||
elif [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
|
||||
npm rebuild sharp --platform=linux --arch=x64 \
|
||||
|| npm install sharp --platform=linux --arch=x64 --save-exact=false
|
||||
else
|
||||
npx prisma db push
|
||||
npm rebuild sharp || true
|
||||
fi
|
||||
|
||||
# Wait until PostgreSQL is reachable before applying schema.
|
||||
until node -e "const u=new URL(process.env.DATABASE_URL||''); const net=require('net'); const s=net.createConnection({host:u.hostname,port:Number(u.port||5432)}); s.on('connect',()=>{s.end(); process.exit(0);}); s.on('error',()=>process.exit(1)); setTimeout(()=>process.exit(1), 1000);" ; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
npx prisma db push
|
||||
|
||||
node prisma/seed.mjs
|
||||
|
||||
exec npm run dev -- --host 0.0.0.0 --port 3000
|
||||
|
||||
Reference in New Issue
Block a user