Skip to content

feat(deployments): split project dependencies and code into separate layers - #4551

Merged
myftija merged 3 commits into
mainfrom
split-image-dependency-layers
Aug 10, 2026
Merged

feat(deployments): split project dependencies and code into separate layers#4551
myftija merged 3 commits into
mainfrom
split-image-dependency-layers

Conversation

@myftija

@myftija myftija commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Deploy images previously shipped node_modules and the bundled task code in a single layer, so every deploy re-pushed and re-pulled the full dependency tree even when nothing in it changed. The generated Containerfile now copies /app/node_modules as its own layer and the app files separately. With unchanged dependencies the dependency layer is identical across deploys, so registries and workers already have it and only the code layer moves.

…ayers

The final image stage copied all of /app in one layer, so node_modules
was re-pushed and re-pulled on every deploy even when dependencies were
unchanged. Copy node_modules as its own layer and the bundled code
(via a stage that strips node_modules) separately, so unchanged
dependencies produce an identical blob that registries and workers
already have.
Create node_modules after post-install commands so a command that
prunes it can't fail the final-stage copy, keep the original install
instruction so existing layer caches still hit, and make the code
stage's node_modules removal work as a non-root user when a directory
is read-only.
@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b3f9604

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
trigger.dev Patch
@internal/dashboard-agent Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/python Patch
@trigger.dev/react-hooks Patch
@trigger.dev/redis-worker Patch
@trigger.dev/rsc Patch
@trigger.dev/schema-to-json Patch
@trigger.dev/sdk Patch
@trigger.dev/database Patch
@trigger.dev/otlp-importer Patch
@trigger.dev/rbac Patch
@trigger.dev/sso Patch
@internal/cache Patch
@internal/clickhouse Patch
@internal/llm-model-catalog Patch
@internal/metrics-pipeline Patch
@internal/redis Patch
@internal/replication Patch
@internal/run-engine Patch
@internal/run-store Patch
@internal/schedule-engine Patch
@internal/testcontainers Patch
@internal/tracing Patch
@internal/tsql Patch
@internal/sdk-compat-tests Patch

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

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Node and Bun Containerfiles now create separate dependency and application-code layers. The build stage retains node_modules, while a new code stage excludes it before the final image copies both sources separately. Tests cover layer separation and command ordering for both runtimes. A patch Changeset documents the image-layer update.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main change but omits the required checklist, testing details, changelog, screenshots, and issue reference. Add the required template sections and complete the checklist, testing steps, changelog, screenshots, and issue reference.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: separating project dependencies and code into distinct deployment image layers.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch split-image-dependency-layers

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@myftija myftija changed the title perf(cli): split deployed image dependencies and code into separate layers feat(deployments): split project dependencies and code into separate layers Aug 10, 2026
… in the code stage

chmod -R u+w itself fails on a directory without owner execute; u+rwX
grants traversal as it recurses. Also trim generated-Containerfile
comments to the non-obvious constraints.
@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@trigger.dev/build

npm i https://pkg.pr.new/@trigger.dev/build@b3f9604

trigger.dev

npm i https://pkg.pr.new/trigger.dev@b3f9604

@trigger.dev/core

npm i https://pkg.pr.new/@trigger.dev/core@b3f9604

@trigger.dev/python

npm i https://pkg.pr.new/@trigger.dev/python@b3f9604

@trigger.dev/react-hooks

npm i https://pkg.pr.new/@trigger.dev/react-hooks@b3f9604

@trigger.dev/redis-worker

npm i https://pkg.pr.new/@trigger.dev/redis-worker@b3f9604

@trigger.dev/rsc

npm i https://pkg.pr.new/@trigger.dev/rsc@b3f9604

@trigger.dev/schema-to-json

npm i https://pkg.pr.new/@trigger.dev/schema-to-json@b3f9604

@trigger.dev/sdk

npm i https://pkg.pr.new/@trigger.dev/sdk@b3f9604

commit: b3f9604

@myftija
myftija marked this pull request as ready for review August 10, 2026 11:58

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread packages/cli-v3/src/deploy/buildImage.ts
@myftija
myftija merged commit bd8ce4a into main Aug 10, 2026
54 checks passed
@myftija
myftija deleted the split-image-dependency-layers branch August 10, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants