Repository navigation
fix(docker): keep the host's node_modules, .next and .env out of the web app image - #55
Merged
Merged
Conversation
…web app image nextjs-frontend had no .dockerignore, so COPY . . brought in whatever a native pnpm install or pnpm dev left behind: node_modules built for the host (macOS binaries on a Mac, or packages from before a lockfile change, which then regenerated an older API client in make dev), .next caches and .env.local with AUTH_SECRET. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ja26f8Npk3M6ixFhE1WEfe
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.
Description
Before: building the web app image after a native
pnpm installcopied the host'snode_modulesinto it withCOPY . .. These were macOS binaries over the image's Linux ones, plus whatever openapi-ts version the host had. In the dev stack the older openapi-ts (0.83) rewrote the generated client on every start and left the git tree dirty..env.localsecrets and.nextcaches went into the image as well.After:
nextjs-frontend/.dockerignorekeepsnode_modules,.next, coverage,.env*(except.env.example), tsbuildinfo andshared-dataout of the build context, for bothDockerfileandDockerfile.prod.Motivation and Context
Found while testing main end to end with both docker stacks.
Steps to reproduce (if appropriate):
Run
pnpm installinnextjs-frontend/, thenmake dev, andgit statusshows the regenerated client. With this change the prod build context dropped to 5.35 MB with the host'snode_modulespresent. The rebuilt image serves/login(200).Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ja26f8Npk3M6ixFhE1WEfe
Generated by Claude Code