feat: implement entrypoint script for backend to handle migrations and server startup

This commit is contained in:
Jose Selesan
2026-09-28 19:41:50 -03:00
parent 88c8b2ec90
commit 54f1c7ab34
6 changed files with 68 additions and 38 deletions

View File

@@ -23,21 +23,6 @@ x-backend-env: &backend-env
EMAIL_FROM: "${EMAIL_FROM:-Gruperly <no-reply@gruperly.com>}"
services:
# Corre una vez por deploy: aplica prisma/migrations y sale con código 0.
# No reinicia nunca; si falla, `api` no arranca (ver depends_on de más abajo).
migrate:
build:
context: .
dockerfile: Dockerfile.backend
target: migrate
environment:
DATABASE_URL: "${DATABASE_URL:?falta DATABASE_URL}"
restart: "no"
# Dokploy deipa con `up -d`; con tty el compose adjunta la salida del
# contenedor y el error de Prisma aparece en el log del deploy, en vez de
# un exit 1 sin contexto.
tty: true
api:
build:
context: .
@@ -45,9 +30,6 @@ services:
target: api
environment: *backend-env
restart: unless-stopped
depends_on:
migrate:
condition: service_completed_successfully
expose:
- "4000"