From 426f7007433e3443bb983fc8cb1c7d7f7614cbd4 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Sat, 20 Jun 2026 17:49:33 +0000 Subject: [PATCH] Add dev container support 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 --- .devcontainer/Dockerfile | 7 ++++ .devcontainer/devcontainer-lock.json | 9 +++++ .devcontainer/devcontainer.json | 53 ++++++++++++++++++++++++++++ .github/dependabot.yml | 4 +++ README.md | 2 ++ 5 files changed, 75 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer-lock.json create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..b46b2fb --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,7 @@ +FROM mcr.microsoft.com/devcontainers/rust:2-1-trixie +RUN sudo apt update && sudo apt upgrade -y +RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash +RUN cargo binstall -y wasm-tools +RUN cargo binstall -y wkg +RUN cargo binstall -y wac-cli +RUN cargo binstall -y wasmtime-cli diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000..cdd6112 --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,9 @@ +{ + "features": { + "ghcr.io/devcontainers/features/github-cli:1": { + "version": "1.1.0", + "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671", + "integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671" + } + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..3fbe24e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +// 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 +{ + "name": "cli", + "build": { + "dockerfile": "Dockerfile" + }, + + // Use 'mounts' to make the cargo cache persistent in a Docker Volume. + "mounts": [ + { + "source": "devcontainer-cargo-cache-${devcontainerId}", + "target": "/usr/local/cargo", + "type": "volume" + }, + { + "source": "devcontainer-rustup-cache-${devcontainerId}", + "target": "/usr/local/rustup", + "type": "volume" + } + ], + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "cargo check", + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "dev.containers.githubCLILoginWithToken": true + }, + "extensions": [ + "bytecodealliance.wit-idl", + "github.vscode-github-actions", + "ms-azuretools.vscode-containers", + "rust-lang.rust-analyzer", + "streetsidesoftware.code-spell-checker", + "tamasfe.even-better-toml", + "vadimcn.vscode-lldb" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7db7281..5c1266c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,3 +12,7 @@ updates: directory: "/" schedule: interval: daily +- package-ecosystem: devcontainers + directory: "/" + schedule: + interval: weekly diff --git a/README.md b/README.md index cf605a1..2da5b18 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ A collection of utility components that remix wasi:cli types and interfaces. ## Build +A [dev container](https://containers.dev) is available that contains the necessary tools and configuration out of the box. + Prereqs: - a rust toolchain - [`wasm-tools`](https://github.com/bytecodealliance/wasm-tools)