GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add container support to `stellar contract build` by fnando · Pull Request #2678 · stellar/stellar-cli

Conversation

@fnando

@fnando fnando commented Aug 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

What

Adds stellar contract build --image <ref>, which builds a contract inside a container image instead of compiling locally. The working tree is bind-mounted at /source, the image's own stellar contract build runs there, and the resulting wasm lands on the host — including copies to --out-dir when set. Any tag or digest ref is accepted.

It reuses the existing container-engine abstraction, so --engine, --docker-host, and the default engine set by stellar container use all apply, along with resource limits (--cpus, --memory). Workspaces with several cdylibs build each package, sharing one container.

Before forwarding flags, the image is probed once (a single throwaway container) for the CLI binary name (soroban vs stellar), its version, and the default rustup toolchain. Forwarded flags (--locked, --optimize, --optimize=false) are gated by the image's version so an older image doesn't fail on an unknown flag, and RUSTUP_TOOLCHAIN is pinned to the image's own toolchain so a rust-toolchain.toml in the mounted source can't redirect the build. --no-image-pull builds against an image already present locally (offline/air-gapped, digest-pinned, or never pushed), and --print-commands-only emits a copy-pasteable reproduce line.

On Linux the build container is deliberately run as the invoking user's uid:gid (--user), so wasm written into the bind-mounted target/ is owned by that user rather than root. Docker Desktop (macOS) and Apple's container already map ownership to the host user, so this is Linux-only. It assumes the image keeps CARGO_HOME/RUSTUP_HOME writable by non-root users, as the official image does.

Why

Lets you build a contract inside a container image with a fixed CLI and Rust toolchain, without needing a matching Rust build toolchain locally — no local wasm target and no pinned rustc. A local cargo is still used for workspace discovery (package selection and locating the workspace root); fully removing that dependency by running discovery inside the image is left as a follow-up.

Known limitations

The combined image probe requires /bin/sh and rustup in the image (as the official rust-based image provides). With --print-commands-only nothing is probed, so the reproduce line assumes a current stellar image and omits the toolchain pin. Running an arbitrary image with root-owned toolchain dirs may fail the Linux uid:gid build.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@fnando
fnando requested a review from a team as a code owner August 12, 2026 17:02
Copilot AI balanced review requested due to automatic review settings August 12, 2026 17:02
@github-project-automation github-project-automation Bot added this to DevX Aug 12, 2026
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 12, 2026
@fnando
Add container support to contract build.
60e7f35
@fnando
fnando force-pushed the contract-build-container branch from 4e80769 to 60e7f35 Compare August 12, 2026 17:02
Copilot started reviewing on behalf of fnando August 12, 2026 17:02
View session
@fnando fnando self-assigned this Aug 12, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Aug 12, 2026
Copilot AI reviewed Aug 12, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

Adds containerized contract builds using Docker-compatible or Apple container engines.

Changes:

  • Adds image-based builds, probing, resource limits, artifact collection, and interruption handling.
  • Integrates asynchronous builds with deploy/upload flows.
  • Adds CLI documentation, dependencies, and tests.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
FULL_HELP_DOCS.md Documents container build options.
cmd/soroban-cli/src/commands/mod.rs Adds the container options heading.
cmd/soroban-cli/src/commands/contract/upload.rs Awaits automatic builds.
cmd/soroban-cli/src/commands/contract/mod.rs Awaits contract builds.
cmd/soroban-cli/src/commands/contract/deploy/wasm.rs Awaits deploy-time builds.
cmd/soroban-cli/src/commands/contract/build/container.rs Implements containerized builds.
cmd/soroban-cli/src/commands/contract/build.rs Adds container flags and routing.
cmd/soroban-cli/src/commands/container/shared.rs Extends shared engine helpers.
cmd/soroban-cli/Cargo.toml Adds Linux UID/GID support.
cmd/crates/soroban-test/tests/it/build.rs Tests generated container commands.
Cargo.lock Locks the new dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

fnando added 3 commits August 12, 2026 14:36
@fnando
Make no-image-pull fail when image is missing.
2da8e75
@fnando
Test image build selects package by manifest path.
be9643d
@fnando
Pick freshest wasm when collecting build output.
c69ec2d
@fnando
fnando requested review from leighmcculloch and mootz12 August 12, 2026 19:50
leighmcculloch
leighmcculloch reviewed Aug 13, 2026
View reviewed changes

@leighmcculloch leighmcculloch left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Couple questions about scope and how this will evolve to be the default way to build to make sure what we build now will evolve well into that.

There are also a couple things claude noticed that I've let pass through verbatim because they appear meaningful problems to consider.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build/container.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread cmd/soroban-cli/src/commands/contract/build.rs Resolved

Uh oh!

There was an error while loading. Please reload this page.

fnando added 2 commits August 14, 2026 10:49
@fnando
Resolve cargo metadata once per container build.
70db288
@fnando
Make container build pull only with --pull flag.
891fd04
leighmcculloch
leighmcculloch approved these changes Aug 17, 2026
View reviewed changes
@fnando
fnando merged commit a29a322 into main Aug 17, 2026
229 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@fnando
fnando deleted the contract-build-container branch August 17, 2026 12:12
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in DevX Aug 17, 2026
@leighmcculloch leighmcculloch mentioned this pull request Aug 18, 2026
Fix manifest path separator in container build #2688
Merged
leighmcculloch added a commit that referenced this pull request Aug 20, 2026
@leighmcculloch
Fix manifest path separator in container build (#2688)
1e3bc83
### What

Build `--manifest-path` for `contract build --container`/`--image` with
a forward-slash join instead of `Path::display()`.

### Why

`rel.display()` renders with the host OS separator, so on Windows it
emits backslashes even though the path is passed to `contract build`
running inside a Linux container, breaking every Windows CI run
(`build-and-test-windows (msrv)` and `(latest)`) since #2678 landed.

### Known limitations

N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@leighmcculloch leighmcculloch leighmcculloch approved these changes
@mootz12 mootz12 Awaiting requested review from mootz12

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@fnando fnando

Labels

None yet

Projects

DevX
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@fnando @leighmcculloch
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.