Skip to content

Commit cad0f52

Browse files
authored
Add dev container support (#106)
A dev container can be used to develop and build this project. App specific settings are included for VS Code. Signed-off-by: Scott Andrews <scott@andrews.me>
1 parent 02125fb commit cad0f52

5 files changed

Lines changed: 75 additions & 3 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM mcr.microsoft.com/devcontainers/rust:2-1-trixie
2+
RUN sudo apt update && sudo apt upgrade -y
3+
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
4+
RUN cargo binstall -y wasm-tools
5+
RUN cargo binstall -y wkg
6+
RUN cargo binstall -y wac-cli
7+
RUN cargo binstall -y wasmtime-cli
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"features": {
3+
"ghcr.io/devcontainers/features/github-cli:1": {
4+
"version": "1.1.0",
5+
"resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671",
6+
"integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671"
7+
}
8+
}
9+
}

.devcontainer/devcontainer.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
3+
{
4+
"name": "static-config",
5+
"build": {
6+
"dockerfile": "Dockerfile"
7+
},
8+
9+
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
10+
"mounts": [
11+
{
12+
"source": "devcontainer-cargo-cache-${devcontainerId}",
13+
"target": "/usr/local/cargo",
14+
"type": "volume"
15+
},
16+
{
17+
"source": "devcontainer-rustup-cache-${devcontainerId}",
18+
"target": "/usr/local/rustup",
19+
"type": "volume"
20+
}
21+
],
22+
23+
// Features to add to the dev container. More info: https://containers.dev/features.
24+
"features": {
25+
"ghcr.io/devcontainers/features/github-cli:1": {}
26+
},
27+
28+
// Use 'postCreateCommand' to run commands after the container is created.
29+
"postCreateCommand": "cargo check",
30+
31+
// Configure tool-specific properties.
32+
"customizations": {
33+
// Configure properties specific to VS Code.
34+
"vscode": {
35+
// Set *default* container specific settings.json values on container create.
36+
"settings": {
37+
"dev.containers.githubCLILoginWithToken": true
38+
},
39+
"extensions": [
40+
"bytecodealliance.wit-idl",
41+
"github.vscode-github-actions",
42+
"ms-azuretools.vscode-containers",
43+
"rust-lang.rust-analyzer",
44+
"streetsidesoftware.code-spell-checker",
45+
"tamasfe.even-better-toml",
46+
"vadimcn.vscode-lldb"
47+
]
48+
}
49+
}
50+
51+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
52+
// "remoteUser": "root"
53+
}

.github/dependabot.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@ updates:
44
directory: "/"
55
schedule:
66
interval: daily
7-
open-pull-requests-limit: 10
87
- package-ecosystem: rust-toolchain
98
directory: "/"
109
schedule:
1110
interval: daily
12-
open-pull-requests-limit: 10
1311
- package-ecosystem: cargo
1412
directory: "/"
1513
schedule:
1614
interval: daily
17-
open-pull-requests-limit: 10
1815
groups:
1916
wasm-tools:
2017
patterns:
2118
- wasm-compose
2219
- wasm-metadata
2320
- wit-component
21+
- package-ecosystem: devcontainers
22+
directory: "/"
23+
schedule:
24+
interval: weekly

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Create custom wasi:config components with static values.
1313

1414
## Build
1515

16+
A [dev container](https://containers.dev) is available that contains the necessary tools and configuration out of the box.
17+
1618
Prereqs:
1719
- a rust toolchain
1820
- [`wasm-tools`](https://github.com/bytecodealliance/wasm-tools)

0 commit comments

Comments
 (0)