Skip to content

Docker: migrate au boot + garde DB pendant next build - #11

Merged
PiLep merged 1 commit into
mainfrom
cursor/docker-migrate-entrypoint-4dd8
Jul 27, 2026
Merged

Docker: migrate au boot + garde DB pendant next build#11
PiLep merged 1 commit into
mainfrom
cursor/docker-migrate-entrypoint-4dd8

Conversation

@PiLep

@PiLep PiLep commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Corrige deux problèmes de déploiement Docker / build :

  1. SQLITE_BUSY pendant next buildlib/auth.ts n’ouvre plus la DB disque pendant phase-production-build / edge (:memory:).
  2. Tables manquantes en prod — l’image ne pouvait pas lancer auth:migrate. Au boot :
    • scripts/entrypoint.shscripts/migrate.mjs puis server.js
    • Crée user/session/account/verification/organization/member/invitation/passkey + auth_invite/signal_journal + indexes
    • Seed AUTH_ALLOWED_EMAILS

Fichiers

  • lib/auth.ts — garde anti-build
  • scripts/migrate.mjs — migration standalone (JS pur)
  • scripts/entrypoint.sh
  • DockerfileENTRYPOINT + better-sqlite3 après le COPY standalone
  • docs/AUTH.md

Test plan

  • docker build OK (plus de SQLITE_BUSY)
  • Conteneur au démarrage log [migrate] OK puis sert l’app
  • Volume sans tables org → boot → bootstrap espace OK
  • npm test / npx tsc --noEmit OK
Open in Web Open in Cursor 

Guard lib/auth.ts against opening the on-disk SQLite during
phase-production-build / edge (use :memory: instead) to avoid SQLITE_BUSY
from parallel build workers. Ship scripts/migrate.mjs + entrypoint.sh so
the container creates Better Auth and app tables (including organizations)
and seeds AUTH_ALLOWED_EMAILS before starting Next.js.

Co-authored-by: Pile <pierre@kanta.fr>
@PiLep
PiLep marked this pull request as ready for review July 27, 2026 20:17
@PiLep
PiLep merged commit 6b74db5 into main Jul 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants