Skip to content

fix(sdks): handle multi-source COPY/ADD in fromDockerfile#1355

Merged
mishushakov merged 2 commits into
mainfrom
mishushakov/fix-issue-1349
May 27, 2026
Merged

fix(sdks): handle multi-source COPY/ADD in fromDockerfile#1355
mishushakov merged 2 commits into
mainfrom
mishushakov/fix-issue-1349

Conversation

@mishushakov
Copy link
Copy Markdown
Member

Summary

  • Fixes fromDockerfile: multi-source COPY silently drops all sources except the first #1349: Template.fromDockerfile (JS) and Template.from_dockerfile (Python) silently dropped intermediate sources from multi-source COPY/ADD, keeping only the first one and producing broken images without warning.
  • Both parsers now emit one copy() call per source to the same destination (matching Docker semantics), preserving --chown across all calls.
  • Added tests in both SDKs (multi-source COPY, and multi-source COPY with --chown), plus changesets for e2b and @e2b/python-sdk.

Test plan

  • pnpm run test tests/template/methods/fromDockerfile.test.ts (JS)
  • poetry run pytest tests/{async,sync}/template_*/methods/test_from_dockerfile.py (Python)
  • pnpm run format / pnpm run lint

🤖 Generated with Claude Code

Previously, Template.fromDockerfile (JS) and Template.from_dockerfile
(Python) silently dropped intermediate sources from multi-source
COPY/ADD instructions, keeping only the first source. This produced
broken images (e.g. missing package-lock.json) without warning.

Emit one copy() call per source so all sources land at the destination,
matching Docker semantics. Preserves --chown across all calls.

Fixes #1349

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cla-bot cla-bot Bot added the cla-signed label May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Package Artifacts

Built from f878330. Download artifacts from this workflow run.

JS SDK (e2b@2.26.1-mishushakov-fix-issue-1349.0):

npm install ./e2b-2.26.1-mishushakov-fix-issue-1349.0.tgz

CLI (@e2b/cli@2.10.3-mishushakov-fix-issue-1349.0):

npm install ./e2b-cli-2.10.3-mishushakov-fix-issue-1349.0.tgz

Python SDK (e2b==2.24.0+mishushakov-fix-issue-1349):

pip install ./e2b-2.24.0+mishushakov.fix.issue.1349-py3-none-any.whl

@cursor
Copy link
Copy Markdown

cursor Bot commented May 27, 2026

PR Summary

Low Risk
Scoped parser fix with regression tests; behavior change only affects multi-source COPY/ADD, which was previously wrong.

Overview
Fixes a silent correctness bug in Dockerfile → template conversion: multi-source COPY/ADD lines (e.g. COPY a b c /dest/) previously kept only the first source, so templates could miss files with no error.

JS (dockerfileParser.ts) and Python (dockerfile_parser.py) now treat every path before the destination as a source and emit one copy() per source to the same dest, applying --chown on each call. Tests cover plain multi-source COPY and multi-source COPY with --chown in the JS SDK and Python async/sync suites; changesets patch e2b and @e2b/python-sdk.

Reviewed by Cursor Bugbot for commit a5407c6. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: a5407c6

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

This PR includes changesets to release 2 packages
Name Type
e2b Patch
@e2b/python-sdk 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

Copy link
Copy Markdown
Contributor

@matthewlouisbrockman matthewlouisbrockman left a comment

Choose a reason for hiding this comment

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

tests only cover COPY not ADD but not blocking

@mishushakov mishushakov merged commit a6bf71a into main May 27, 2026
25 checks passed
@mishushakov mishushakov deleted the mishushakov/fix-issue-1349 branch May 27, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fromDockerfile: multi-source COPY silently drops all sources except the first

2 participants