Use local Prisma binary in entrypoint to avoid npx network hang.

npx can stall checking the registry on restricted networks; migrate never finished so the API never started.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-08 15:49:42 +03:30
co-authored by Cursor
parent 6703d2080a
commit 4e48275054
+15 -3
View File
@@ -3,10 +3,22 @@ set -e
echo "Node: $(node -v)"
echo "OpenSSL: $(openssl version 2>/dev/null || echo missing)"
echo "Waiting for database & applying migrations..."
# فقط host را لاگ کن تا سکرت لو نرود
DB_HOST=$(printf '%s' "$DATABASE_URL" | sed -n 's|.*@\([^:/]*\).*|\1|p')
echo "DATABASE_URL host: ${DB_HOST:-unknown}"
if [ ! -x ./node_modules/.bin/prisma ]; then
echo "ERROR: ./node_modules/.bin/prisma پیدا نشد. روی سرور npm ci بزن."
exit 1
fi
# از npx استفاده نکن — روی بعضی سرورها برای چک رجیستری آویزان می‌ماند
PRISMA="./node_modules/.bin/prisma"
echo "Waiting for database & applying migrations..."
i=0
until npx prisma migrate deploy; do
until $PRISMA migrate deploy; do
i=$((i + 1))
if [ "$i" -ge 30 ]; then
echo "Database/migrate failed after 30 attempts"
@@ -18,7 +30,7 @@ done
if [ "${RUN_SEED:-false}" = "true" ]; then
echo "Seeding database..."
npx prisma db seed || true
$PRISMA db seed || true
fi
echo "Starting API on port ${PORT:-3000}..."