diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d7583925ae61d..3c0db6643ee3c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,21 +4,30 @@ ARG VARIANT="1.18-bullseye" FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 -ARG NODE_VERSION="none" -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + # Chromium for running Turbopack benchmarks + chromium \ + # Used for plotters graph visualizations in turbopack benchmarks + libfontconfig1-dev -# [Optional] Uncomment this section to install additional OS packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends +# Add hyperfine, a useful benchmarking tool +RUN dpkgArch="$(dpkg --print-architecture)"; \ + wget "https://github.com/sharkdp/hyperfine/releases/download/v1.12.0/hyperfine_1.12.0_${dpkgArch}.deb" && dpkg -i "hyperfine_1.12.0_${dpkgArch}.deb" -# [Optional] Uncomment the next lines to use go get to install anything else you need -# USER vscode -# RUN go get -x +# +# Everything below is run as the vscode user. If superuser permissions are necessary, +# run it before this. Otherwise, prefer running as the vscode user. +# +USER vscode -# [Optional] Uncomment this line to install global node packages. -RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g vercel yarn yalc pnpm nodemon" 2>&1 +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then umask 0002 && sh -c ". /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION}" 2>&1; fi -# Add hyperfine, a useful benchmarking tool -RUN dpkgArch="$(dpkg --print-architecture)"; \ - wget "https://github.com/sharkdp/hyperfine/releases/download/v1.12.0/hyperfine_1.12.0_${dpkgArch}.deb" && dpkg -i "hyperfine_1.12.0_${dpkgArch}.deb" +RUN sh -c ". /usr/local/share/nvm/nvm.sh && npm install -g vercel yarn yalc pnpm nodemon" 2>&1 + +# The installer from https://rustup.rs/ homepage, with the following changes: +# * `-y` to accept without interactivity +# * `--default-toolchain none` to avoid installing stable rust. Our specific toolchain is installed post-create. +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f7145a39f155f..d9c7d4cd6c635 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/go { - "name": "turbo (go, node)", + "name": "turbo (go, node, rust)", "build": { "dockerfile": "Dockerfile", "args": { @@ -34,6 +34,7 @@ "github.vscode-pull-request-github", "golang.go", "heybourn.headwind", + "rust-lang.rust-analyzer", "silvenon.mdx", "windmilleng.vscode-go-autotest", "yzhang.markdown-all-in-one" @@ -43,7 +44,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "go version", + "postCreateCommand": "go version && cargo --version", // Invoking `cargo` will eagerly install the toolchain specified in rust-toolchain file // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode",