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

@myftijamyftija 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-botBot 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
NameType
trigger.devPatch
@internal/dashboard-agentPatch
@trigger.dev/buildPatch
@trigger.dev/corePatch
@trigger.dev/pythonPatch
@trigger.dev/react-hooksPatch
@trigger.dev/redis-workerPatch
@trigger.dev/rscPatch
@trigger.dev/schema-to-jsonPatch
@trigger.dev/sdkPatch
@trigger.dev/databasePatch
@trigger.dev/otlp-importerPatch
@trigger.dev/rbacPatch
@trigger.dev/ssoPatch
@internal/cachePatch
@internal/clickhousePatch
@internal/llm-model-catalogPatch
@internal/metrics-pipelinePatch
@internal/redisPatch
@internal/replicationPatch
@internal/run-enginePatch
@internal/run-storePatch
@internal/schedule-enginePatch
@internal/testcontainersPatch
@internal/tracingPatch
@internal/tsqlPatch
@internal/sdk-compat-testsPatch

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

coderabbitaiBot 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 nameStatusExplanationResolution
Description check⚠️ WarningThe 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 nameStatusExplanation
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
Title check✅ PassedThe 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.

@myftijamyftija changed the title perf(cli): split deployed image dependencies and code into separate layersfeat(deployments): split project dependencies and code into separate layersAug 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

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-integrationdevin-ai-integrationBot 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 threadpackages/cli-v3/src/deploy/buildImage.ts
@myftija
myftija merged commit bd8ce4a into mainAug 10, 2026
54 checks passed
@myftija
myftija deleted the split-image-dependency-layers branch August 10, 2026 12:44
@github-actionsgithub-actionsBot mentioned this pull request Aug 10, 2026
Sign up for freeto 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

@myftija@ericallam@matt-aitken