diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 84f89d57..fe7c9c2d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,7 +4,6 @@ FROM mcr.microsoft.com/devcontainers/base:debian AS base ARG USER=vscode ARG GROUP=vscode -ARG RUST_TOOLCHAIN=1.81.0 ENV HOME="/home/${USER}" ENV PATH="$HOME/.cargo/bin:$PATH" @@ -49,6 +48,8 @@ RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhisto USER $USER +ARG RUST_TOOLCHAIN=1.81.0 + # Install rust RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ && rustup default ${RUST_TOOLCHAIN} \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ae49f8bf..16f7f57a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,14 +3,15 @@ { "name": "Hyperlight", - "image": "ghcr.io/hyperlight-dev/hyperlight-devcontainer:latest", + "image": "ghcr.io/dblnz/hyperlight-devcontainer:latest", "containerUser": "vscode", // Environment for the container also used by in the `postCreateCommand` "containerEnv": { + "DEVICE": "/dev/kvm", + "KVM_SHOULD_BE_PRESENT": "true", "REMOTE_USER": "vscode", - "REMOTE_GROUP": "vscode", - "DEVICE": "/dev/kvm" + "REMOTE_GROUP": "vscode" }, "runArgs": [ @@ -24,7 +25,8 @@ "vscode": { "extensions": [ "ms-vscode.cmake-tools", - "rust-lang.rust-analyzer" + "rust-lang.rust-analyzer", + "vadimcn.vscode-lldb" ] } } diff --git a/.github/workflows/CreateDevcontainerImage.yml b/.github/workflows/CreateDevcontainerImage.yml index 4553f9ed..8f772d00 100644 --- a/.github/workflows/CreateDevcontainerImage.yml +++ b/.github/workflows/CreateDevcontainerImage.yml @@ -2,9 +2,12 @@ name: Create and publish devcontainer Docker image on: push: + branches: + - "main" paths: - ".devcontainer/Dockerfile" - ".github/workflows/CreateDevcontainerImage.yml" + - "rust-toolchain.toml" # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: @@ -13,6 +16,7 @@ env: USER: vscode GROUP: vscode RUST_TOOLCHAIN: 1.81.0 + RUST_TOOLCHAIN_FILE: rust-toolchain.toml # There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. jobs: @@ -29,6 +33,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. + + - name: Read Rust toolchain version + id: toolchain + run: | + version=$(cat ${{ env.RUST_TOOLCHAIN_FILE }} | sed -n '/\[toolchain\]/,/^\[/{/^\s*channel = /s/[^"]*"\([^"]*\)".*/\1/p}') + echo "RUST_TOOLCHAIN=${version}" >> "$GITHUB_OUTPUT" + - name: Log in to the Container registry uses: docker/login-action@v1 with: @@ -55,4 +66,4 @@ jobs: build-args: | USER=${{ env.USER }} GROUP=${{ env.GROUP }} - RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} + RUST_TOOLCHAIN=${{ steps.toolchain.outputs.RUST_TOOLCHAIN }}