Fix Prisma OpenSSL error on Alpine Linux (Docker)

- Add openssl + openssl-dev to Dockerfile apk install; Alpine does not
  ship OpenSSL by default but Prisma's query engine binary requires it
- Add binaryTargets to schema.prisma generator:
    native                    → used during docker build (npx prisma generate)
    linux-musl-openssl-3.0.x  → correct engine binary for Alpine at runtime
  Without the explicit target Prisma defaults to openssl-1.1.x, which
  does not exist on Alpine 3.18+, producing the "Could not parse schema
  engine response" error at migrate/startup time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 22:32:25 -05:00
parent 7ea358e66a
commit 2c95d01e7a
2 changed files with 5 additions and 3 deletions

View File

@@ -2,8 +2,8 @@ FROM node:20-alpine
WORKDIR /app WORKDIR /app
# Install build tools needed for better-sqlite3 native bindings # Install build tools + OpenSSL (required by Prisma query engine on Alpine)
RUN apk add --no-cache python3 make g++ RUN apk add --no-cache python3 make g++ openssl openssl-dev
# Copy package manifests # Copy package manifests
COPY package*.json ./ COPY package*.json ./

View File

@@ -1,5 +1,7 @@
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
// linux-musl-openssl-3.0.x = Alpine Linux (Docker); native = local dev/build
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
} }
datasource db { datasource db {