diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6e665e8..c8e4e3d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,10 +1,17 @@ -FROM ubuntu:18.04 - -WORKDIR /home/ - -COPY . . - -RUN bash ./setup.sh - -ENV PATH="/root/.cargo/bin:$PATH" +FROM ubuntu:latest +# Install basic dependencies +RUN apt-get update && \ + apt-get install -y \ + curl \ + wget \ + git \ + ca-certificates \ + gnupg2 \ + jq \ + sudo \ + nano \ + vim \ + build-essential \ + openssl && \ + rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index aa50763..98453e2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,20 +1,28 @@ { - "name": "Codespaces Rust Starter", - "extensions": [ - "cschleiden.vscode-github-actions", - "ms-vsliveshare.vsliveshare", - "matklad.rust-analyzer", - "serayuzgur.crates", - "vadimcn.vscode-lldb" - ], - "dockerFile": "Dockerfile", - "settings": { - "editor.formatOnSave": true, - "terminal.integrated.shell.linux": "/usr/bin/zsh", - "files.exclude": { - "**/CODE_OF_CONDUCT.md": true, - "**/LICENSE": true - } - } -} - + "name": "bp7-rs Dev Container", + "build": { + "context": "..", + "dockerfile": "Dockerfile" + }, + "remoteUser": "ubuntu", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "configureZshAsDefaultShell": true + }, + "ghcr.io/devcontainers/features/rust:1": { + "targets": "wasm32-unknown-unknown,wasm32-wasip1" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "github.vscode-github-actions", + "rust-lang.rust-analyzer", + "fill-labs.dependi", + "tamasfe.even-better-toml", + "vadimcn.vscode-lldb" + ] + } + }, + "postCreateCommand": "./.devcontainer/post-create.sh" +} \ No newline at end of file diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 0000000..8d7671d --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Install additional Rust toolchain +rustup install nightly + +# Install common Rust tools (using cargo-binstall for speed) +curl -L --proto '=https' --tlsv1.2 -sSf \ + https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + +cargo binstall -y \ + cargo-expand \ + cargo-edit \ + cargo-audit \ + cargo-geiger \ + cbindgen \ + wasm-pack \ + wasmtime-cli diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh deleted file mode 100755 index e55026b..0000000 --- a/.devcontainer/setup.sh +++ /dev/null @@ -1,34 +0,0 @@ -## update and install some things we should probably have -apt-get update -apt-get install -y \ - curl \ - git \ - gnupg2 \ - jq \ - sudo \ - zsh \ - vim \ - build-essential \ - openssl - -## Install rustup and common components -curl https://sh.rustup.rs -sSf | sh -s -- -y -rustup install nightly -rustup component add rustfmt -rustup component add rustfmt --toolchain nightly -rustup component add clippy -rustup component add clippy --toolchain nightly - -cargo install cargo-expand -cargo install cargo-edit -cargo install cargo-audit -cargo install cargo-geiger - - -## setup and install oh-my-zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -cp -R /root/.oh-my-zsh /home/$USERNAME -cp /root/.zshrc /home/$USERNAME -sed -i -e "s/\/root\/.oh-my-zsh/\/home\/$USERNAME\/.oh-my-zsh/g" /home/$USERNAME/.zshrc -chown -R $USER_UID:$USER_GID /home/$USERNAME/.oh-my-zsh /home/$USERNAME/.zshrc -