Skip to content

dev_container: Preserve build context for docker-compose Dockerfiles#53140

Merged
KyleBarton merged 3 commits intozed-industries:mainfrom
yeetypete:fix/docker-compose-build-context
Apr 6, 2026
Merged

dev_container: Preserve build context for docker-compose Dockerfiles#53140
KyleBarton merged 3 commits intozed-industries:mainfrom
yeetypete:fix/docker-compose-build-context

Conversation

@yeetypete
Copy link
Copy Markdown
Contributor

@yeetypete yeetypete commented Apr 4, 2026

When a Docker Compose service specifies a build context, the generated override file was replacing it with an empty context directory. This meant Dockerfiles that reference files relative to their build context (e.g. COPY . /app) would fail. The fix preserves the original build context from the compose service, falling back to the empty context directory only when no context was specified.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Fixed docker compose Dockerfile build context not being preserved in dev_container integration.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 4, 2026
@zed-codeowner-coordinator zed-codeowner-coordinator Bot requested review from a team, kubkon and reflectronic and removed request for a team April 4, 2026 10:53
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Apr 4, 2026
@yeetypete yeetypete force-pushed the fix/docker-compose-build-context branch from f65c5a1 to 30db2d1 Compare April 4, 2026 11:05
@maxdeviant maxdeviant changed the title fix(dev_container): preserve build context for docker-compose Dockerfiles Apr 4, 2026
@yeetypete
Copy link
Copy Markdown
Contributor Author

@KyleBarton I was sparse on details in my initial PR description. If you make a docker compose service that uses build instead of an image key, and then try to do some COPY operations inside the referenced dockerfile you should be able to repro.

@KyleBarton
Copy link
Copy Markdown
Collaborator

Yep, looks good on testing - thanks for all the Docker compose fixes, it's been a huge help!

@KyleBarton KyleBarton merged commit dee4250 into zed-industries:main Apr 6, 2026
30 checks passed
@zed-zippy zed-zippy Bot added the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 7, 2026
@KyleBarton
Copy link
Copy Markdown
Collaborator

@zed-zippy approved

MasoudAlali pushed a commit to MasoudAlali/zed-ide that referenced this pull request Apr 7, 2026
…ed-industries#53140)

When a Docker Compose service specifies a build context, the generated
override file was replacing it with an empty context directory. This
meant Dockerfiles that reference files relative to their build context
(e.g. `COPY . /app`) would fail. The fix preserves the original build
context from the compose service, falling back to the empty context
directory only when no context was specified.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed docker compose Dockerfile build context not being preserved in
dev_container integration.

---------

Co-authored-by: KyleBarton <kjb@initialcapacity.io>
@MrSubidubi MrSubidubi removed the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 7, 2026
@zed-zippy zed-zippy Bot added the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 8, 2026
@dinocosta dinocosta removed the PR state:needs review Used to label PRs that are in need of a post-merge approval label Apr 8, 2026
piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
…ed-industries#53140)

When a Docker Compose service specifies a build context, the generated
override file was replacing it with an empty context directory. This
meant Dockerfiles that reference files relative to their build context
(e.g. `COPY . /app`) would fail. The fix preserves the original build
context from the compose service, falling back to the empty context
directory only when no context was specified.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed docker compose Dockerfile build context not being preserved in
dev_container integration.

---------

Co-authored-by: KyleBarton <kjb@initialcapacity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

5 participants