fix: copy Prisma schema into Docker deps stage for postinstall hook#73
Merged
TerrifiedBug merged 1 commit intomainfrom Mar 8, 2026
Merged
fix: copy Prisma schema into Docker deps stage for postinstall hook#73TerrifiedBug merged 1 commit intomainfrom
TerrifiedBug merged 1 commit intomainfrom
Conversation
PR #71 added `"postinstall": "prisma generate"` to package.json. This breaks the Docker build because Stage 1 (deps) only copies package.json and pnpm-lock.yaml before running pnpm install — prisma generate fails when it can't find the schema. Copy prisma/ and prisma.config.ts into the deps stage so the postinstall hook succeeds.
Contributor
Greptile SummaryThis PR fixes a Docker build breakage introduced by PR #71, which added
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Stage 1: deps (node:22-alpine)"] -->|"COPY package.json pnpm-lock.yaml"| B
A -->|"COPY prisma/ prisma.config.ts ✅ NEW"| B
B["pnpm install --frozen-lockfile\n(postinstall: prisma generate ✅ succeeds)"]
B --> C["Stage 3: build (node:22-alpine)"]
C -->|"COPY --from=deps node_modules"| D
C -->|"COPY prisma/ prisma.config.ts"| D
D["npx prisma generate\npnpm build"]
D --> E["Stage 4: runner\n(production image)"]
Last reviewed commit: 4064dad |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"postinstall": "prisma generate"topackage.json, which breaks the Docker buildpackage.json+pnpm-lock.yamlbefore runningpnpm install --frozen-lockfile— the postinstall hook runsprisma generatebut fails becauseprisma/schema.prismaisn't present yetprisma/andprisma.config.tsinto the deps stage so the postinstall hook succeedsRoot cause
The Dockerfile has a multi-stage build where Stage 1 installs deps (for caching) and Stage 3 copies source + runs
prisma generateexplicitly. Thepostinstallscript added in #71 madeprisma generaterun during Stage 1 too, where the schema doesn't exist.Test plan
pnpm installstill works locally