Skip to content

Comments

Add dockerfile.#2414

Open
fnando wants to merge 5 commits intomainfrom
dockerfile
Open

Add dockerfile.#2414
fnando wants to merge 5 commits intomainfrom
dockerfile

Conversation

@fnando
Copy link
Member

@fnando fnando commented Feb 24, 2026

What

$ pwd
/Users/fnando/.local/tmp

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli network use testnet
ℹ️  The default network is set to `testnet`

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli keys generate default --fund
✅ Key saved with alias default in "/stellar/identity/default.toml"
✅ Account default funded on "Test SDF Network ; September 2015"

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli keys use default
ℹ️  The default source account is set to `default`

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli contract init /source/hello
ℹ️  Initializing workspace at "/source/hello"
➕ Writing "/source/hello/.gitignore"
➕ Writing "/source/hello/Cargo.toml"
➕ Writing "/source/hello/README.md"
ℹ️  Initializing contract at "/source/hello/contracts/hello-world"
➕ Writing "/source/hello/contracts/hello-world/Cargo.toml"
➕ Writing "/source/hello/contracts/hello-world/Makefile"
➕ Writing "/source/hello/contracts/hello-world/src/lib.rs"
➕ Writing "/source/hello/contracts/hello-world/src/test.rs"

$ cd hello

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli contract build
ℹ️  CARGO_BUILD_RUSTFLAGS=--remap-path-prefix=/usr/local/cargo/registry/src= cargo rustc --manifest-path=contracts/hello-world/Cargo.toml --crate-type=cdylib --target=wasm32v1-none --release
    Updating crates.io index
     Locking 181 packages to latest compatible versions
      Adding arbitrary v1.3.2 (available: v1.4.2)
      Adding crypto-common v0.1.6 (available: v0.1.7)
      Adding derive_arbitrary v1.3.2 (available: v1.4.2)
  Downloaded const-oid v0.9.6
  Downloaded either v1.15.0
  Downloaded ark-ff-macros v0.4.2
  Downloaded dtor v0.1.1
  Downloaded cpufeatures v0.2.17
  Downloaded semver v1.0.27
  Downloaded keccak v0.1.6
  Downloaded num-conv v0.2.0
  Downloaded ident_case v1.0.1
  Downloaded cfg-if v1.0.4
  Downloaded powerfmt v0.2.0
  Downloaded time-core v0.1.8
  Downloaded block-buffer v0.10.4
  Downloaded hex v0.4.3
  Downloaded hash32 v0.3.1
  Downloaded ctor-proc-macro v0.0.6
  Downloaded soroban-env-guest v25.0.1
  Downloaded crate-git-revision v0.0.6
  Downloaded byteorder v1.5.0
  Downloaded indexmap-nostd v0.4.0
  Downloaded zeroize_derive v1.4.3
  Downloaded wasmi_arena v0.4.1
  Downloaded heck v0.5.0
  Downloaded equivalent v1.0.2
  Downloaded darling_macro v0.21.3
  Downloaded ctor v0.5.0
  Downloaded base16ct v0.2.0
  Downloaded num-derive v0.4.2
  Downloaded rustc_version v0.4.1
  Downloaded fnv v1.0.7
  Downloaded bytes-lit v0.0.5
  Downloaded ark-bn254 v0.4.0
  Downloaded ark-serialize-derive v0.4.2
  Downloaded rand_chacha v0.3.1
  Downloaded downcast-rs v1.2.1
  Downloaded ref-cast v1.0.25
  Downloaded version_check v0.9.5
  Downloaded signature v2.2.0
  Downloaded cfg_eval v0.1.2
  Downloaded rfc6979 v0.4.0
  Downloaded hex-literal v0.4.1
  Downloaded dyn-clone v1.0.20
  Downloaded itoa v1.0.17
  Downloaded strsim v0.11.1
  Downloaded stable_deref_trait v1.2.1
  Downloaded ref-cast-impl v1.0.25
  Downloaded ppv-lite86 v0.2.21
  Downloaded primeorder v0.13.6
  Downloaded visibility v0.1.1
  Downloaded soroban-spec-rust v25.1.1
  Downloaded soroban-spec v25.1.1
  Downloaded group v0.13.0
  Downloaded rand_core v0.6.4
  Downloaded escape-bytes v0.1.1
  Downloaded pkcs8 v0.10.2
  Downloaded stellar-strkey v0.0.13
  Downloaded wasmi_core v0.13.0
  Downloaded base64ct v1.8.3
  Downloaded schemars v1.2.1
  Downloaded zeroize v1.8.2
  Downloaded spin v0.9.8
  Downloaded zmij v1.0.21
  Downloaded hmac v0.12.1
  Downloaded schemars v0.8.22
  Downloaded unicode-ident v1.0.24
  Downloaded soroban-env-common v25.0.1
  Downloaded schemars v0.9.0
  Downloaded typenum v1.19.0
  Downloaded serde v1.0.228
  Downloaded itertools v0.10.5
  Downloaded hashbrown v0.13.2
  Downloaded indexmap v2.13.0
  Downloaded hashbrown v0.16.1
  Downloaded libm v0.2.16
  Downloaded hashbrown v0.12.3
  Downloaded ed25519-dalek v2.2.0
  Downloaded chrono v0.4.44
  Downloaded num-bigint v0.4.6
  Downloaded wasmparser-nostd v0.100.2
  Downloaded curve25519-dalek v4.1.3
  Downloaded soroban-wasmi v0.31.1-soroban.20.0.1
  Downloaded wasmparser v0.116.1
  Downloaded serde_json v1.0.149
  Downloaded serde_with v3.16.1
  Downloaded time v0.3.47
  Downloaded zerocopy v0.8.39
  Downloaded syn v1.0.109
  Downloaded soroban-sdk v25.1.1
  Downloaded syn v2.0.117
  Downloaded ark-bls12-381 v0.4.0
  Downloaded memchr v2.8.0
  Downloaded k256 v0.13.4
  Downloaded der v0.7.10
  Downloaded crypto-bigint v0.5.5
  Downloaded ark-ff v0.4.2
  Downloaded rand v0.8.5
  Downloaded heapless v0.8.0
  Downloaded ethnum v1.5.2
  Downloaded darling_core v0.21.3
  Downloaded base64 v0.22.1
  Downloaded proc-macro2 v1.0.106
  Downloaded prettyplease v0.2.37
  Downloaded num-traits v0.2.19
  Downloaded indexmap v1.9.3
  Downloaded soroban-env-host v25.0.1
  Downloaded darling_core v0.20.11
  Downloaded serde_derive v1.0.228
  Downloaded libc v0.2.182
  Downloaded serde_core v1.0.228
  Downloaded elliptic-curve v0.13.8
  Downloaded p256 v0.13.2
  Downloaded iana-time-zone v0.1.65
  Downloaded ark-ec v0.4.2
  Downloaded time-macros v0.2.27
  Downloaded stellar-strkey v0.0.16
  Downloaded soroban-sdk-macros v25.1.1
  Downloaded smallvec v1.15.1
  Downloaded serde_with_macros v3.16.1
  Downloaded ecdsa v0.16.9
  Downloaded derivative v2.2.0
  Downloaded darling v0.21.3
  Downloaded darling v0.20.11
  Downloaded sha3 v0.10.8
  Downloaded ark-poly v0.4.2
  Downloaded arbitrary v1.3.2
  Downloaded ahash v0.8.12
  Downloaded thiserror-impl v1.0.69
  Downloaded thiserror v1.0.69
  Downloaded subtle v2.6.1
  Downloaded static_assertions v1.1.0
  Downloaded spki v0.7.3
  Downloaded soroban-env-macros v25.0.1
  Downloaded sha2 v0.10.9
  Downloaded sec1 v0.7.3
  Downloaded quote v1.0.44
  Downloaded once_cell v1.21.3
  Downloaded getrandom v0.2.17
  Downloaded ed25519 v2.2.3
  Downloaded macro-string v0.1.4
  Downloaded soroban-ledger-snapshot v25.1.1
  Downloaded digest v0.10.7
  Downloaded ark-std v0.4.0
  Downloaded ff v0.13.1
  Downloaded data-encoding v2.10.0
  Downloaded autocfg v1.5.0
  Downloaded soroban-builtin-sdk-macros v25.0.1
  Downloaded generic-array v0.14.9
  Downloaded num-integer v0.1.46
  Downloaded deranged v0.5.8
  Downloaded paste v1.0.15
  Downloaded crypto-common v0.1.6
  Downloaded ark-ff-asm v0.4.2
  Downloaded ark-serialize v0.4.2
  Downloaded derive_arbitrary v1.3.2
  Downloaded darling_macro v0.20.11
  Downloaded dtor-proc-macro v0.0.6
  Downloaded stellar-xdr v25.0.0
  Downloaded 157 crates (11.8MiB) in 0.69s (largest was `stellar-xdr` at 2.2MiB)
   Compiling proc-macro2 v1.0.106
   Compiling quote v1.0.44
   Compiling unicode-ident v1.0.24
   Compiling serde_core v1.0.228
   Compiling zmij v1.0.21
   Compiling serde v1.0.228
   Compiling serde_json v1.0.149
   Compiling itoa v1.0.17
   Compiling memchr v2.8.0
   Compiling strsim v0.11.1
   Compiling fnv v1.0.7
   Compiling ident_case v1.0.1
   Compiling version_check v0.9.5
   Compiling typenum v1.19.0
   Compiling autocfg v1.5.0
   Compiling libc v0.2.182
   Compiling generic-array v0.14.9
   Compiling schemars v0.8.22
   Compiling syn v2.0.117
   Compiling dyn-clone v1.0.20
   Compiling cfg-if v1.0.4
   Compiling data-encoding v2.10.0
   Compiling ethnum v1.5.2
   Compiling cpufeatures v0.2.17
   Compiling escape-bytes v0.1.1
   Compiling num-traits v0.2.19
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling semver v1.0.27
   Compiling digest v0.10.7
   Compiling either v1.15.0
   Compiling sha2 v0.10.9
   Compiling itertools v0.10.5
   Compiling equivalent v1.0.2
   Compiling thiserror v1.0.69
   Compiling hashbrown v0.16.1
   Compiling indexmap v2.13.0
   Compiling prettyplease v0.2.37
   Compiling base64 v0.22.1
   Compiling heapless v0.8.0
   Compiling byteorder v1.5.0
   Compiling wasmparser v0.116.1
   Compiling darling_core v0.21.3
   Compiling darling_core v0.20.11
   Compiling hash32 v0.3.1
   Compiling num-integer v0.1.46
   Compiling rustc_version v0.4.1
   Compiling static_assertions v1.1.0
   Compiling stable_deref_trait v1.2.1
   Compiling serde_derive v1.0.228
   Compiling cfg_eval v0.1.2
   Compiling thiserror-impl v1.0.69
   Compiling num-derive v0.4.2
   Compiling darling_macro v0.21.3
   Compiling darling_macro v0.20.11
   Compiling num-bigint v0.4.6
   Compiling macro-string v0.1.4
   Compiling darling v0.21.3
   Compiling serde_with_macros v3.16.1
   Compiling darling v0.20.11
   Compiling heck v0.5.0
   Compiling visibility v0.1.1
   Compiling bytes-lit v0.0.5
   Compiling crate-git-revision v0.0.6
   Compiling hex v0.4.3
   Compiling stellar-strkey v0.0.13
   Compiling stellar-xdr v25.0.0
   Compiling soroban-env-common v25.0.1
   Compiling stellar-strkey v0.0.16
   Compiling soroban-sdk v25.1.1
   Compiling serde_with v3.16.1
   Compiling soroban-spec v25.1.1
   Compiling soroban-spec-rust v25.1.1
   Compiling soroban-env-macros v25.0.1
   Compiling soroban-env-guest v25.0.1
   Compiling soroban-sdk-macros v25.1.1
   Compiling hello-world v0.0.0 (/source/contracts/hello-world)
    Finished `release` profile [optimized] target(s) in 22.89s
ℹ️  Build Summary:
    Wasm File: target/wasm32v1-none/release/hello_world.wasm (660 bytes)
    Wasm Hash: 541d7b10d1ea80173bf2608895a26f8b35bb5cd2a98bef3543a84301c9684781
    Wasm Size: 660 bytes
    Exported Functions: 1 found
      • hello
✅ Build Complete

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli contract deploy --alias hello --wasm target/wasm32v1-none/release/hello_world.wasm
ℹ️  Skipping install because wasm already installed
ℹ️  Using wasm hash 541d7b10d1ea80173bf2608895a26f8b35bb5cd2a98bef3543a84301c9684781
ℹ️  Simulating deploy transaction…
ℹ️  Transaction hash is 59b8a5ecb635768418f8c3474b7701271156eb5495c9436967ef3177b6aac3f6
🔗 https://stellar.expert/explorer/testnet/tx/59b8a5ecb635768418f8c3474b7701271156eb5495c9436967ef3177b6aac3f6
ℹ️  Signing transaction: 59b8a5ecb635768418f8c3474b7701271156eb5495c9436967ef3177b6aac3f6
🌎 Submitting deploy transaction…
🔗 https://lab.stellar.org/r/testnet/contract/CAHYV76HAMFJV4VQWBXQXR2YOGPWJ5N42DAAJ3CIMYAWWO6GD7CLAGBH
✅ Deployed!
CAHYV76HAMFJV4VQWBXQXR2YOGPWJ5N42DAAJ3CIMYAWWO6GD7CLAGBH

$ docker run -it -v /Users/fnando/.local/tmp:/stellar -v $PWD:/source stellar-cli contract invoke --id hello --send=yes -- hello --to docker
ℹ️  Signing transaction: 77a14df0501dc76021f2e69f8cbc8b22cb5b3bcb55f7941f2522ce6379d01b8c
["Hello","docker"]

Why

This is the first step so we can publish a docker image, as requested in #2387.

Known limitations

N/A

Copilot AI review requested due to automatic review settings February 24, 2026 18:54
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Feb 24, 2026
@fnando fnando self-assigned this Feb 24, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Feb 24, 2026
@fnando fnando added enhancement New feature or request cli Related to Soroban CLI labels Feb 24, 2026
Copy link
Contributor

Copilot AI left a 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 container support to run stellar inside Docker, enabling containerized workflows (e.g., Kubernetes automation) as a first step toward publishing an official image (Issue #2387).

Changes:

  • Add a Dockerfile that installs the stellar-cli release .deb and Rust + wasm32v1-none target for contract builds.
  • Add an entrypoint.sh that starts a D-Bus session and gnome-keyring, then executes the CLI from /source.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Dockerfile Builds a runtime image with Rust + wasm target and installs the latest released stellar-cli .deb, sets entrypoint.
entrypoint.sh Initializes D-Bus + gnome-keyring for secure-store support, then runs the requested command.

@fnando fnando enabled auto-merge (squash) February 24, 2026 20:12
Copy link
Member

@leighmcculloch leighmcculloch left a comment

Choose a reason for hiding this comment

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

Couple thoughts inline, only major concern is the dependence on debs.

Comment on lines +5 to +12
RUN apt-get update && \
apt-get install -y --no-install-recommends dbus gnome-keyring libdbus-1-3 libudev1 libssl3 && \
LATEST=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | grep '"tag_name"' | sed 's/.*"v\(.*\)".*/\1/') && \
ARCH=$(dpkg --print-architecture) && \
curl -fsSL "https://github.com/stellar/stellar-cli/releases/download/v${LATEST}/stellar-cli_${LATEST}_${ARCH}.deb" \
-o /tmp/stellar-cli.deb && \
dpkg -i /tmp/stellar-cli.deb && \
rm -rf /var/lib/apt/lists/* /tmp/stellar-cli.deb
Copy link
Member

Choose a reason for hiding this comment

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

What's the motivation of installing from the deb? The inefficiency we've seen in the past is that to get a docker image requires a long round trip of getting a deb built, etc. Where-as if the image is built from source, there's no dependency hoop jumping. I'd make this build from source because of that.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seemed easier than downloading the tar, uncompressing and moving to the right place. This also ensures we're dogfooding the installer.

I don't see a benefit on building from source in this one particular case, but maybe I'm being shortsighted. 🤔

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

Labels

cli Related to Soroban CLI enhancement New feature or request

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

2 participants