-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Problem
Two related bugs prevent the standalone Dockerfile from building and running correctly:
1. Missing COPY patches ./patches in standalone Dockerfile
Commit 32b33664 ("fix: copy root patches/ dir into Docker builds") added COPY patches ./patches to Dockerfile.server but not to the standalone Dockerfile. Since scripts/postinstall.cjs now requires ../patches/fix-pglite-prisma-bytes.cjs during yarn install, the standalone Docker build fails at the yarn install step:
error Command failed with exit code 1.
code: 'MODULE_NOT_FOUND',
requireStack: [ '/repo/scripts/postinstall.cjs' ]
2. Migration path resolution in standalone.ts doesn't find prisma/migrations
standalone.ts migrate() resolves the prisma migrations directory using only two candidates:
const candidates = [
path.join(process.cwd(), "prisma", "migrations"),
path.join(path.dirname(process.execPath), "prisma", "migrations"),
];In the standalone Dockerfile, WORKDIR is /repo and the CMD runs from there, so process.cwd() resolves to /repo. But the prisma migrations directory is at /repo/packages/happy-server/prisma/migrations. Neither candidate matches, causing the migration to fail with:
Could not find prisma/migrations directory
The container then exits with code 1 and enters a crash loop.
Suggested Fix
Dockerfile — Add the missing COPY patches ./patches line after COPY scripts ./scripts (same as Dockerfile.server):
COPY package.json yarn.lock ./
COPY scripts ./scripts
+COPY patches ./patchesstandalone.ts — Add a __dirname-relative candidate so the migration finder works regardless of working directory:
const candidates = [
path.join(process.cwd(), "prisma", "migrations"),
path.join(path.dirname(process.execPath), "prisma", "migrations"),
+ path.join(__dirname, "..", "prisma", "migrations"),
+ path.resolve(__dirname, "..", "..", "..", "packages", "happy-server", "prisma", "migrations"),
];The __dirname-relative path resolves correctly from the source file location regardless of the process working directory, which is important for Docker deployments where WORKDIR may differ from the package root.
Environment
- Standalone Docker deployment using
Dockerfile(notDockerfile.server) - Node 20, yarn workspaces
WORKDIR /repoin Dockerfile