fix(deployment): add auto database migration on container startup
- Create docker-entrypoint.sh to run prisma migrate deploy before app start - Update Dockerfile to use entrypoint script - Ensures database schema is always up-to-date after deployment - Fixes: CRUD kependudukan error 500 di staging karena tabel belum dibuat Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
13
docker-entrypoint.sh
Normal file
13
docker-entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🔄 Running database migrations..."
|
||||
cd /app
|
||||
bunx prisma migrate deploy || {
|
||||
echo "❌ Migration failed!"
|
||||
exit 1
|
||||
}
|
||||
echo "✅ Migrations completed successfully"
|
||||
|
||||
echo "🚀 Starting application..."
|
||||
exec bun start
|
||||
Reference in New Issue
Block a user