diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index ed092cae..00000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM mcr.microsoft.com/devcontainers/rust:latest - -USER vscode -RUN cargo install --locked soroban-cli -RUN rustup target add wasm32-unknown-unknown - -# The following should be run at a project level: -# soroban config network add testnet --rpc-url "http://host.docker.internal:8000/soroban/rpc" --network-passphrase "Test SDF Network ; September 2015" -# soroban keys generate alice --network testnet \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index db8277df..478c9d1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,6 +21,20 @@ Solarkraft is written in [TypeScript][]. It uses the standard development toolin - [prettier][] is the code formatter - [husky] is the hook manager that runs basic tests on git commits + ### 2.1 Dev containers + +To easily set up your dev environment, we provide VSCode [dev containers][]. + +There is one for Solarkraft development in [`./solarkraft`](./solarkraft/.devcontainer/), and one for Soroban development in [`./ContractExamples`](./ContractExamples/.devcontainer/). + +To use the dev containers: + +0. Install [Docker](https://www.docker.com/). +1. Open VSCode in the respective directory (e.g., `cd solarkraft/ && code .`). +2. Install the [`Dev Containers` extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) by Microsoft (VSCode may also prompt you to do this). +3. Build and open the container by selecting **Dev Containers: Reopen in Container** in the VSCode command palette (`Ctrl-Shift-P`, or `Cmd-Shift-P` on macOS). + + ## 3. Basic development commands 1. On the first run, install the required npm packages: @@ -60,17 +74,10 @@ We are still discovering an optimal setup. The Soroban instructions are given in seem to build well on MacOS, owing to [this issue](https://discord.com/channels/1179099813879492721/1196869246429429960/1229764850591469649). -To work around the above problem, we are using [VSCode dev containers][]: - -> This simply takes the Rust dev container from Microsoft and installs soroban-cli and the appropriate wasm target. -> -> If the quickstart Docker image is run outside the container, its RPC endpoint is available as -> http://host.docker.internal:8000/soroban/rpc. - -Further, see [Dockerfile](.devcontainer/Dockerfile). - +To work around these problems, you can use our dev containers (see above), to get a reproducible dev environment. +[dev containers]: https://code.visualstudio.com/docs/devcontainers/containers [TypeScript]: https://www.typescriptlang.org/ [npm]: https://www.npmjs.com/ [tsc]: https://www.typescriptlang.org/docs/handbook/compiler-options.html diff --git a/.devcontainer/devcontainer.json b/ContractExamples/.devcontainer/devcontainer.json similarity index 50% rename from .devcontainer/devcontainer.json rename to ContractExamples/.devcontainer/devcontainer.json index 944074ed..455fb4d0 100644 --- a/.devcontainer/devcontainer.json +++ b/ContractExamples/.devcontainer/devcontainer.json @@ -1,17 +1,18 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/rust +// A dev container for working with Soroban smart contracts. +// For format details, see https://aka.ms/devcontainer.json. { "name": "Soroban", - "build": { - "dockerfile": "Dockerfile" - }, + "image": "mcr.microsoft.com/devcontainers/rust:latest", "features": { - "ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}, + "ghcr.io/lee-orr/rusty-dev-containers/wasm32-unknown-unknown:0": {}, + "ghcr.io/lee-orr/rusty-dev-containers/cargo-binstall:0": { + "packages": "soroban-cli" + }, + "ghcr.io/stuartleeks/dev-container-features/shell-history:0": {} }, "customizations": { "vscode": { "extensions": [ - "rust-lang.rust-analyzer", "vscodevim.vim" ], "settings": { diff --git a/solarkraft/.devcontainer/devcontainer.json b/solarkraft/.devcontainer/devcontainer.json new file mode 100644 index 00000000..6f760232 --- /dev/null +++ b/solarkraft/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +// A dev container for developing Solarkraft. +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "Solarkraft", + "image": "mcr.microsoft.com/devcontainers/typescript-node:20-bookworm", + "features": { + "ghcr.io/devcontainers/features/java:1": {}, + "ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}, + "ghcr.io/devcontainers-contrib/features/bash-command:1": { + "command": "wget -qO- https://github.com/informalsystems/apalache/releases/download/v0.44.10/apalache.tgz | sudo tar xz -C /opt/" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "vscodevim.vim" + ], + "settings": { + "extensions.ignoreRecommendations": true, // don't show recommendations for extensions + "terminal.integrated.copyOnSelection": true + } + } + } +} \ No newline at end of file