Skip to content

Commit

Permalink
Update devcontainer setup
Browse files Browse the repository at this point in the history
  • Loading branch information
purkhusid committed May 2, 2024
1 parent 416a67a commit 626e28e
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 27 deletions.
24 changes: 0 additions & 24 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,4 @@ RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
file \
&& sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*

#########################################
### Bazel and Bazel releated binaries ###
#########################################
# Install bazelisk
RUN curl -o $HOME/bin/bazelisk-linux-$TARGETARCH -fsSL https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-$TARGETARCH \
&& mv $HOME/bin/bazelisk-linux-$TARGETARCH $HOME/bin/bazelisk \
&& chmod +x $HOME/bin/bazelisk \
&& ln -s $HOME/bin/bazelisk $HOME/bin/bazel

# Install bazel-watcher
RUN curl -o $HOME/bin/ibazel_linux_$TARGETARCH -fsSL https://github.com/bazelbuild/bazel-watcher/releases/download/v0.25.1/ibazel_linux_$TARGETARCH \
&& mv $HOME/bin/ibazel_linux_$TARGETARCH $HOME/bin/ibazel \
&& chmod +x $HOME/bin/ibazel

# Install buildifier
RUN curl -o $HOME/bin/buildifier-linux-$TARGETARCH -fsSL https://github.com/bazelbuild/buildtools/releases/download/v7.1.0/buildifier-linux-$TARGETARCH \
&& mv $HOME/bin/buildifier-linux-$TARGETARCH $HOME/bin/buildifier \
&& chmod +x $HOME/bin/buildifier

# Install buildozer
RUN curl -o $HOME/bin/buildozer-linux-$TARGETARCH -fsSL https://github.com/bazelbuild/buildtools/releases/download/v7.1.0/buildozer-linux-$TARGETARCH \
&& mv $HOME/bin/buildozer-linux-$TARGETARCH $HOME/bin/buildozer \
&& chmod +x $HOME/bin/buildozer

COPY --chown=vscode ./devcontainer.bazelrc /home/vscode/.bazelrc
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"BazelBuild.vscode-bazel",
"ms-dotnettools.csharp",
"Ionide.Ionide-fsharp",
"zxh404.vscode-proto3",
"timonwong.shellcheck",
"mutantdino.resourcemonitor"
]
Expand All @@ -59,6 +57,7 @@
},
"ghcr.io/devcontainers/features/github-cli:1.0.11": {
"version": "2.42.1"
}
},
"./features/bazel": {}
}
}
21 changes: 21 additions & 0 deletions .devcontainer/features/bazel/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Bazel",
"id": "bazel",
"version": "0.0.1",
"description": "Install Bazel and related tools",
"customizations": {
"vscode": {
"extensions": [
"BazelBuild.vscode-bazel"
],
"settings": {
"bazel.executable": "bazel",
"bazel.buildifierExecutable": "buildifier",
"bazel.lsp.enabled": true,
"bazel.lsp.command": "starpls",
"bazel.lsp.args": []
}
}
},
"options": {}
}
36 changes: 36 additions & 0 deletions .devcontainer/features/bazel/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -eou pipefail

if [ $(uname -m) == "x86_64" ]; then
TARGETARCH=amd64
else
TARGETARCH=arm64
fi

# Install bazelisk
curl -o /usr/local/bin/bazelisk-linux-$TARGETARCH -fsSL https://github.com/bazelbuild/bazelisk/releases/download/v1.19.0/bazelisk-linux-$TARGETARCH \
&& mv /usr/local/bin/bazelisk-linux-$TARGETARCH /usr/local/bin/bazelisk \
&& chmod +x /usr/local/bin/bazelisk \
&& ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel

# Install bazel-watcher
curl -o /usr/local/bin/ibazel_linux_$TARGETARCH -fsSL https://github.com/bazelbuild/bazel-watcher/releases/download/v0.24.0/ibazel_linux_$TARGETARCH \
&& mv /usr/local/bin/ibazel_linux_$TARGETARCH /usr/local/bin/ibazel \
&& chmod +x /usr/local/bin/ibazel

# Install buildifier
curl -o /usr/local/bin/buildifier-linux-$TARGETARCH -fsSL https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildifier-linux-$TARGETARCH \
&& mv /usr/local/bin/buildifier-linux-$TARGETARCH /usr/local/bin/buildifier \
&& chmod +x /usr/local/bin/buildifier

# Install buildozer
curl -o /usr/local/bin/buildozer-linux-$TARGETARCH -fsSL https://github.com/bazelbuild/buildtools/releases/download/v6.4.0/buildozer-linux-$TARGETARCH \
&& mv /usr/local/bin/buildozer-linux-$TARGETARCH /usr/local/bin/buildozer \
&& chmod +x /usr/local/bin/buildozer

# Install Starlark larnguage server
curl -o /usr/local/bin/starpls-linux-$TARGETARCH -fsSL https://github.com/withered-magic/starpls/releases/download/v0.1.12/starpls-linux-$TARGETARCH \
&& mv /usr/local/bin/starpls-linux-$TARGETARCH /usr/local/bin/starpls \
&& chmod +x /usr/local/bin/starpls

0 comments on commit 626e28e

Please sign in to comment.