Skip to content

Commit

Permalink
Split dev container (#31)
Browse files Browse the repository at this point in the history
Split the dev container into two separate contaienrs:
- TypeScript + Java + Apalache
- Rust + Soroban
  • Loading branch information
thpani authored Apr 18, 2024
1 parent a4a065b commit 24e7def
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 25 deletions.
9 changes: 0 additions & 9 deletions .devcontainer/Dockerfile

This file was deleted.

25 changes: 16 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
24 changes: 24 additions & 0 deletions solarkraft/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}

0 comments on commit 24e7def

Please sign in to comment.