fix(cli): build the code layer with an exclude copy instead of deleting node_modules - #4878
Conversation
…ng node_modules The code stage was a snapshot of the build stage that ran `chmod -R u+rwX node_modules && rm -rf node_modules`; on overlayfs the chmod copies every dependency file into the throwaway layer before the rm walks it again, which made deploys of large projects markedly slower since 4.5.11. The stage now copies /app from the build stage with node_modules excluded (`COPY --exclude`, stable in the dockerfile:1 frontend the templates already pin), producing the same dependency/code layer split with no extra walks.
🦋 Changeset detectedLatest commit: d35badb The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (41)
🧰 Additional context used📓 Path-based instructions (9)We use vitest exclusively.📄 CodeRabbit inference engine (AGENTS.md) Files:
**Prefer static imports over dynamic imports.**📄 CodeRabbit inference engine (AGENTS.md) Files:
Add crumbs as you write code — not just when debugging.📄 CodeRabbit inference engine (AGENTS.md) Files:
Build Docker images using `src/deploy/buildImage.ts` for local Docker/Depot or remote builds📄 CodeRabbit inference engine (packages/cli-v3/CLAUDE.md) Files:
Deploy mode code should be located in `src/deploy/` and handles bundling, archiving, building Docker images, and pushing to registry📄 CodeRabbit inference engine (packages/cli-v3/CLAUDE.md) Files:
Use vitest for all tests in the Trigger.dev repository📄 CodeRabbit inference engine (.github/copilot-instructions.md) Files:
Use function declarations instead of default exports📄 CodeRabbit inference engine (.github/copilot-instructions.md) Files:
Use types over interfaces for TypeScript Avoid using enums; prefer string unions or const objects instead📄 CodeRabbit inference engine (.github/copilot-instructions.md) Files:
When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs Do not use high-cardinality attributes in OTEL metr...📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc) Files:
🔇 Additional comments (5)
WalkthroughThe Bun and Node generated Containerfiles now create the Merge Risk: ⚪ Minimal · up to The code-layer build now copies application files while excluding node_modules instead of deleting dependencies from a build-stage snapshot; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
## Summary 1 improvement, 2 bug fixes. ## Improvements - The `trigger.dev deploy` and `trigger.dev dev` commands now warn (with the suggested fix) when your code loads a package through `createRequire()` that won't be available in the deployed image. Previously it would fail at runtime in production to load the package. Deploys also now show bundler warnings for your code instead of discarding them. ([triggerdotdev#4851](triggerdotdev#4851)) ## Bug fixes - Fixes an issue introduced in 4.5.11 that made deploy image builds of projects with large dependency trees noticeably slower. ([triggerdotdev#4878](triggerdotdev#4878)) ## Server changes These changes affect the self-hosted Docker image and Trigger.dev Cloud: - A durable guard improves reliability for runs waiting on triggerAndWait or batchTriggerAndWait if there's a database error that interrupts a child run finishing. ([triggerdotdev#4849](triggerdotdev#4849)) <details> <summary>Raw changeset output</summary> # Releases ## @trigger.dev/build@4.5.16 ### Patch Changes - The `trigger.dev deploy` and `trigger.dev dev` commands now warn (with the suggested fix) when your code loads a package through `createRequire()` that won't be available in the deployed image. Previously it would fail at runtime in production to load the package. Deploys also now show bundler warnings for your code instead of discarding them. ([triggerdotdev#4851](triggerdotdev#4851)) - Updated dependencies: - `@trigger.dev/core@4.5.16` ## trigger.dev@4.5.16 ### Patch Changes - Fixes an issue introduced in 4.5.11 that made deploy image builds of projects with large dependency trees noticeably slower. ([triggerdotdev#4878](triggerdotdev#4878)) - The `trigger.dev deploy` and `trigger.dev dev` commands now warn (with the suggested fix) when your code loads a package through `createRequire()` that won't be available in the deployed image. Previously it would fail at runtime in production to load the package. Deploys also now show bundler warnings for your code instead of discarding them. ([triggerdotdev#4851](triggerdotdev#4851)) - Updated dependencies: - `@trigger.dev/build@4.5.16` - `@trigger.dev/core@4.5.16` - `@trigger.dev/schema-to-json@4.5.16` ## @trigger.dev/core@4.5.16 ### Patch Changes - The `trigger.dev deploy` and `trigger.dev dev` commands now warn (with the suggested fix) when your code loads a package through `createRequire()` that won't be available in the deployed image. Previously it would fail at runtime in production to load the package. Deploys also now show bundler warnings for your code instead of discarding them. ([triggerdotdev#4851](triggerdotdev#4851)) ## @trigger.dev/python@4.5.16 ### Patch Changes - Updated dependencies: - `@trigger.dev/build@4.5.16` - `@trigger.dev/core@4.5.16` - `@trigger.dev/sdk@4.5.16` ## @trigger.dev/react-hooks@4.5.16 ### Patch Changes - Updated dependencies: - `@trigger.dev/core@4.5.16` ## @trigger.dev/redis-worker@4.5.16 ### Patch Changes - Updated dependencies: - `@trigger.dev/core@4.5.16` ## @trigger.dev/rsc@4.5.16 ### Patch Changes - Updated dependencies: - `@trigger.dev/core@4.5.16` ## @trigger.dev/schema-to-json@4.5.16 ### Patch Changes - Updated dependencies: - `@trigger.dev/core@4.5.16` ## @trigger.dev/sdk@4.5.16 ### Patch Changes - Updated dependencies: - `@trigger.dev/core@4.5.16` </details> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fixes a deploy slowdown introduced in #4551 to build the code layer, the generated Containerfile deleted
node_modulesfrom a snapshot of the build stage.New approach: the code stage starts empty and copies the app files with the dependency tree excluded.
COPY --excludeis stable in thedocker/dockerfile:1frontend the templates already pin.