fix(deploy): embed prisma migrate deploy in API startup
Tessera CI/CD / Lint & Type Check (push) Successful in 45s
Tessera CI/CD / Tests (push) Successful in 42s
Tessera CI/CD / Build & Publish Images (push) Successful in 3m52s

- Move prisma to runtime dependencies so it's available in prod image
- API runs migrate deploy before starting (handles fresh installs + updates)
- Remove separate migrate service from prod compose

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-29 14:50:42 +02:00
parent 14e6e8401f
commit e26fbd720e
4 changed files with 5 additions and 19 deletions
+1 -1
View File
@@ -33,4 +33,4 @@ COPY --from=builder /app/apps/api/prisma ./apps/api/prisma
COPY --from=builder /app/packages/shared/src ./packages/shared/src
USER nestjs
EXPOSE 3001
CMD ["node", "apps/api/dist/main.js"]
CMD ["sh", "-c", "node_modules/.bin/prisma migrate deploy --schema apps/api/prisma/schema.prisma && node apps/api/dist/main.js"]
+1 -1
View File
@@ -21,6 +21,7 @@
"@nestjs/platform-express": "^11.0.0",
"@nestjs/schedule": "^6.1.3",
"@prisma/client": "^6.0.0",
"prisma": "^6.0.0",
"@tessera/shared": "workspace:*",
"argon2": "^0.44.0",
"class-transformer": "^0.5.1",
@@ -50,7 +51,6 @@
"@types/nodemailer": "^8.0.1",
"@types/passport-jwt": "^4.0.1",
"@types/passport-local": "^1.0.38",
"prisma": "^6.0.0",
"typescript": "^5.5.0"
}
}
-14
View File
@@ -1,16 +1,4 @@
services:
migrate:
image: git.vicolab.de/schalli/tessera-ctl/api:latest
command: sh -c "cd /app && node_modules/.bin/prisma migrate deploy --schema apps/api/prisma/schema.prisma"
environment:
DATABASE_URL: ${DATABASE_URL}
networks:
- data-net
depends_on:
db:
condition: service_healthy
restart: "no"
web:
image: git.vicolab.de/schalli/tessera-ctl/web:latest
restart: unless-stopped
@@ -39,8 +27,6 @@ services:
depends_on:
db:
condition: service_healthy
migrate:
condition: service_completed_successfully
environment:
DATABASE_URL: ${DATABASE_URL}
JWT_SECRET: ${JWT_SECRET}
+3 -3
View File
@@ -101,6 +101,9 @@ importers:
pdf-parse:
specifier: ^2.4.5
version: 2.4.5
prisma:
specifier: ^6.0.0
version: 6.19.3(typescript@5.9.3)
reflect-metadata:
specifier: ^0.2.0
version: 0.2.2
@@ -135,9 +138,6 @@ importers:
'@types/passport-local':
specifier: ^1.0.38
version: 1.0.38
prisma:
specifier: ^6.0.0
version: 6.19.3(typescript@5.9.3)
typescript:
specifier: ^5.5.0
version: 5.9.3