Skip to content

Commit

Permalink
Merge devcontainer files with turbo-tooling's
Browse files Browse the repository at this point in the history
  • Loading branch information
wbinnssmith authored and Brooooooklyn committed Oct 13, 2022
1 parent b2fd329 commit 927513a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
37 changes: 23 additions & 14 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <your-package-list-here>
# 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 <your-dependency-or-tool>
#
# 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
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand Down

0 comments on commit 927513a

Please sign in to comment.