From 3dd770a6a56942b9f24da9ec7deb27945af6f141 Mon Sep 17 00:00:00 2001 From: felix Date: Fri, 21 Aug 2026 17:44:44 +0200 Subject: [PATCH] Fix Prisma engine load on Alpine: install openssl + pin musl-openssl-3.0.x node:20-alpine ships OpenSSL 3.x and has no libssl.so.1.1. Without the openssl CLI, Prisma's version detection failed and fell back to the openssl-1.1.x engine, which then failed to load its shared library and emitted plain text instead of JSON ("Unexpected token 'E'..."), crashing `prisma migrate deploy` at container startup. - Install openssl in the build and runtime stages so detection succeeds - Pin binaryTargets to linux-musl-openssl-3.0.x so the correct engine is bundled Co-Authored-By: Claude Opus 4.8 --- Dockerfile | 4 ++++ server/prisma/schema.prisma | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 815af68..36439cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,8 @@ RUN npm run build # ── Backend bauen (Express + TS + Prisma) ── FROM node:20-alpine AS server-build +# Prisma braucht OpenSSL zur Erkennung der libssl-Version (sonst Fallback auf 1.1.x -> Engine-Ladefehler) +RUN apk add --no-cache openssl WORKDIR /app/server COPY server/package*.json ./ RUN npm install @@ -17,6 +19,8 @@ RUN npm run build # ── Laufzeit-Image ── FROM node:20-alpine +# OpenSSL auch zur Laufzeit für "prisma migrate deploy" nötig +RUN apk add --no-cache openssl WORKDIR /app ENV NODE_ENV=production COPY --from=server-build /app/server/node_modules ./node_modules diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index 4d1868c..276cb29 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -1,5 +1,6 @@ generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + binaryTargets = ["native", "linux-musl-openssl-3.0.x"] } datasource db {