Hello! In order to avoid problems when working with several projects that are using different soroban's software's versions, I came up with the idea of creating an docker image for each soroban preview. With this we could run scripts that require different soroban-cli versions, rust versions, soroban rust sdks versions, etc...
I have contrubuted in stellar/soroban-example-dapp repo to use this idea:
Check the repo: https://github.com/esteblock/soroban-preview-docker
Also, images are available in Docker Hub!: https://hub.docker.com/r/esteblock/soroban-preview
Write an issue and collaborate!
How to use it?: Short answer
Just run your script inside the container with your favourite preview setup!
docker exec soroban-preview-7 my_script_requires_soroban_cli_0.6.0.sh
For more information, please check the README.md in the project's repo
How to use it?: Long answer, also using stellar/quickstart
In this exemple we'll use Preview 7.
In order to make calls between docker containers, let's create a docker network
- (only once) create a common docker network
docker network create soroban-network
- Run the stellar/quickstart container related to your preview (in this case preview 7)
docker run --rm -ti \
--platform linux/amd64 \
--name stellar \
--network soroban-network \
-p 8000:8000 \
stellar/quickstart:soroban-dev@sha256:81c23da078c90d0ba220f8fc93414d0ea44608adc616988930529c58df278739 \
standalone \
--enable-soroban-rpc \
--protocol-version 20
- Run the soroban-preview:7 image inside a container named soroban-preview-7. Here we'll also share our current directory.
currentDir=$(pwd)
docker run --volume ${currentDir}:/workspace \
--name soroban-preview-7 \
--interactive \
--tty \
-p 8001:8000 \
--detach \
--ipc=host \
--network soroban-network \
soroban-preview:7
- Execute your script inside the soroban-preview-7 container. In your script, instead of using http://localhost:8000, to call the stellar/quickstart container you just need to call
stellar:8000
, becase "stellar" is the name of the quickstart container that is living int he same docker network.
docker exec soroban-preview-7 ./my_soroban_cli_script.sh MY_ARGS
Top comments (0)