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
|
!deploy-bundle.tar.gz
|
||||||
!Dockerfile
|
!Dockerfile
|
||||||
!docker-compose.yml
|
!docker-compose.yml
|
||||||
|
!docker-entrypoint.sh
|
||||||
!.env.example
|
!.env.example
|
||||||
|
|||||||
+11
-4
@@ -1,13 +1,20 @@
|
|||||||
# باندل از گیت میآید؛ داخل ایمیج باز میشود — روی سرور tar لازم نیست
|
# باندل روی glibc ساخته شده؛ Alpine (musl) با Prisma سازگار نیست
|
||||||
FROM node:22-alpine
|
FROM node:22-bookworm-slim
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
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
|
COPY deploy-bundle.tar.gz /tmp/deploy-bundle.tar.gz
|
||||||
RUN tar -xzf /tmp/deploy-bundle.tar.gz -C /app \
|
RUN tar -xzf /tmp/deploy-bundle.tar.gz -C /app \
|
||||||
&& rm /tmp/deploy-bundle.tar.gz \
|
&& rm /tmp/deploy-bundle.tar.gz
|
||||||
&& chmod +x /app/docker-entrypoint.sh
|
|
||||||
|
# entrypoint از ریپو (قابل آپدیت بدون بازسازی کل باندل)
|
||||||
|
COPY docker-entrypoint.sh /app/docker-entrypoint.sh
|
||||||
|
RUN chmod +x /app/docker-entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
echo "DATABASE_URL host check..."
|
||||||
echo "Waiting for database & applying migrations..."
|
echo "Waiting for database & applying migrations..."
|
||||||
i=0
|
i=0
|
||||||
until npx prisma migrate deploy; do
|
until npx prisma migrate deploy; do
|
||||||
@@ -18,5 +19,5 @@ if [ "${RUN_SEED:-false}" = "true" ]; then
|
|||||||
npx prisma db seed || true
|
npx prisma db seed || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting API..."
|
echo "Starting API on port ${PORT:-3000}..."
|
||||||
exec node dist/main.js
|
exec node dist/main.js
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
generator client {
|
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 {
|
datasource db {
|
||||||
|
|||||||
Reference in New Issue
Block a user