Fix Prisma runtime by switching API image to Debian slim
Alpine musl is incompatible with host-built Prisma engines; use bookworm-slim and allow updating entrypoint without repacking the bundle. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
# فقط باندل و فایلهای لازم برای بیلد ایمیج
|
||||
*
|
||||
!deploy-bundle.tar.gz
|
||||
!Dockerfile
|
||||
!docker-compose.yml
|
||||
!docker-entrypoint.sh
|
||||
!.env.example
|
||||
|
||||
+11
-4
@@ -1,13 +1,20 @@
|
||||
# باندل از گیت میآید؛ داخل ایمیج باز میشود — روی سرور tar لازم نیست
|
||||
FROM node:22-alpine
|
||||
# باندل روی glibc ساخته شده؛ Alpine (musl) با Prisma سازگار نیست
|
||||
FROM node:22-bookworm-slim
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends openssl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY deploy-bundle.tar.gz /tmp/deploy-bundle.tar.gz
|
||||
RUN tar -xzf /tmp/deploy-bundle.tar.gz -C /app \
|
||||
&& rm /tmp/deploy-bundle.tar.gz \
|
||||
&& chmod +x /app/docker-entrypoint.sh
|
||||
&& rm /tmp/deploy-bundle.tar.gz
|
||||
|
||||
# entrypoint از ریپو (قابل آپدیت بدون بازسازی کل باندل)
|
||||
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
|
||||
RUN chmod +x /app/docker-entrypoint.sh
|
||||
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "DATABASE_URL host check..."
|
||||
echo "Waiting for database & applying migrations..."
|
||||
i=0
|
||||
until npx prisma migrate deploy; do
|
||||
@@ -18,5 +19,5 @@ if [ "${RUN_SEED:-false}" = "true" ]; then
|
||||
npx prisma db seed || true
|
||||
fi
|
||||
|
||||
echo "Starting API..."
|
||||
echo "Starting API on port ${PORT:-3000}..."
|
||||
exec node dist/main.js
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
|
||||
Reference in New Issue
Block a user