feat(docker): finalise le déploiement compose (sqlite + postgres)

- Compose nettoyé en deux profils isolés (sqlite, postgres) avec
  healthcheck HTTP et network_mode host pour la découverte LAN.
- Override docker-compose.bridge.yml pour les environnements où
  host mode n'est pas disponible (macOS/Windows).
- Entrypoint tolérant : fallback prisma db push quand aucune
  migration n'existe encore.
- Dockerfile robuste sans package-lock.json (npm install fallback).
- .env.docker.example et docker/README.md pour un démarrage en
  une commande.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 14:03:46 +02:00
parent c18d831d89
commit 6c020e7ee3
7 changed files with 411 additions and 35 deletions

View File

@@ -44,8 +44,15 @@ if [ "${DATABASE_PROVIDER:-sqlite}" = "sqlite" ]; then
fi
# --- 3. Migrations Prisma -----------------------------------------
log "Application des migrations Prisma…"
npx prisma migrate deploy
# Si des migrations existent → migrate deploy (production-safe)
# Sinon (premier démarrage sans baseline) → db push pour initialiser le schéma
if [ -d /app/prisma/migrations ] && [ "$(find /app/prisma/migrations -mindepth 1 -maxdepth 1 -type d 2>/dev/null | head -n 1)" != "" ]; then
log "Application des migrations Prisma…"
npx prisma migrate deploy
else
log "Aucune migration trouvée — initialisation du schéma via 'prisma db push'…"
npx prisma db push --skip-generate --accept-data-loss
fi
# --- 4. Seed optionnel --------------------------------------------
if [ "${RUN_SEED:-false}" = "true" ]; then