Make compose dev preserve SQLite between restarts

This commit is contained in:
Ruslan Bakiev
2026-02-18 14:04:05 +07:00
parent 96a1acfd82
commit 676bb9e105
2 changed files with 24 additions and 5 deletions

23
Frontend/scripts/compose-dev.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
# Install deps (container starts from a clean image).
npm ci
# 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

View File

@@ -16,10 +16,7 @@ services:
# OPENAI_API_KEY: "..."
command: >
bash -lc "
npm ci &&
npx prisma db push --force-reset &&
node prisma/seed.mjs &&
npm run dev -- --host 0.0.0.0 --port 3000
./scripts/compose-dev.sh
"
depends_on:
- redis
@@ -34,4 +31,3 @@ services:
volumes:
clientsflow_data:
redis_data: