feat(deploy): auto-run db migrations + seed on stack deploy

Add a migrator Dockerfile target (drizzle-kit migrate + tier-definitions
seed, both idempotent) and wire it as a one-shot compose service that web
waits on via service_completed_successfully. No more manual exec step
after first deploy — runs safely on every redeploy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-01 16:23:54 +02:00
parent 4a90ad910c
commit a4fb62c86c
3 changed files with 25 additions and 9 deletions
+14 -2
View File
@@ -49,6 +49,18 @@ services:
exit 0;
"
migrate:
build:
context: ..
dockerfile: Dockerfile
target: migrator
environment:
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
depends_on:
postgres:
condition: service_healthy
restart: "no"
web:
build:
context: ..
@@ -73,8 +85,8 @@ services:
# published on portainer LXC host; traefik (other LXC) routes here via <this-lxc-ip>:${WEB_PORT}
- "${WEB_PORT:-3000}:3000"
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
redis:
condition: service_started
minio: