The entrypoint invoked the node_modules/.bin/prisma symlink, so Node resolved the CLI's bundled .wasm files relative to .bin/ and crashed with ENOENT on prisma_schema_build_bg.wasm. Call the real CLI entry (node_modules/prisma/build/ index.js) instead so the wasm resolves under prisma/build/. Also add the linux-musl-openssl-3.0.x binaryTarget so the runtime engine matches the alpine runner regardless of build host arch. Verified end-to-end in a built alpine image: migrate deploy applies, and the Prisma client reads/writes against Postgres at runtime.
16 lines
565 B
Bash
16 lines
565 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Apply pending migrations against the database, then start the server.
|
|
# Invoke the real CLI entry (NOT the .bin/prisma symlink): Node resolves the
|
|
# bundled .wasm files relative to the script's own directory, so calling the
|
|
# symlink would look for them under node_modules/.bin/ and fail with ENOENT.
|
|
echo "Running prisma migrate deploy…"
|
|
node node_modules/prisma/build/index.js migrate deploy
|
|
|
|
# Ensure the upload directory exists in the mounted volume.
|
|
mkdir -p "${UPLOAD_DIR:-/data/uploads}"
|
|
|
|
echo "Starting Next.js…"
|
|
exec node server.js
|