Skip to content

Commit f589362

Browse files
CopilotKSXGitHub
andcommitted
devcontainer: multi-arch downloads, shared script, rust base image
Co-authored-by: KSXGitHub <11488886+KSXGitHub@users.noreply.github.com>
1 parent 9d3be1b commit f589362

5 files changed

Lines changed: 46 additions & 26 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
{
22
"name": "parallel-disk-usage (Rust only)",
3-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
4-
"features": {
5-
"ghcr.io/devcontainers/features/rust:1": {
6-
"version": "stable",
7-
"profile": "default"
8-
}
9-
},
3+
"image": "mcr.microsoft.com/devcontainers/rust:1",
104
"customizations": {
115
"vscode": {
126
"extensions": [

.devcontainer/full/devcontainer.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
22
"name": "parallel-disk-usage (full)",
3-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
3+
"image": "mcr.microsoft.com/devcontainers/rust:1",
44
"features": {
5-
"ghcr.io/devcontainers/features/rust:1": {
6-
"version": "stable",
7-
"profile": "default"
8-
},
95
"ghcr.io/devcontainers/features/node:1": {
106
"version": "lts",
117
"nodeGypDependencies": true

.devcontainer/full/post-create.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,4 @@ echo "Installing pnpm and project Node dependencies..." >&2
88
npm install -g pnpm@7.33.7
99
(cd ci/github-actions && pnpm install --frozen-lockfile)
1010

11-
echo "Installing hyperfine from GitHub release..." >&2
12-
hyperfine_version="1.20.0"
13-
hyperfine_archive_name="hyperfine-v${hyperfine_version}-x86_64-unknown-linux-musl"
14-
hyperfine_url="https://github.com/sharkdp/hyperfine/releases/download/v${hyperfine_version}/${hyperfine_archive_name}.tar.gz"
15-
mkdir -p "$HOME/.local/bin"
16-
curl -fsSL "$hyperfine_url" | tar -xz --strip-components=1 -C "$HOME/.local/bin" "${hyperfine_archive_name}/hyperfine"
11+
bash "$(dirname "$0")/../install-hyperfine.sh"

.devcontainer/install-hyperfine.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
# Shared helper: install hyperfine binary from GitHub releases into ~/.local/bin
3+
set -euo pipefail
4+
5+
arch="$(uname -m)"
6+
case "$arch" in
7+
x86_64) hyperfine_target="x86_64-unknown-linux-musl" ;;
8+
aarch64) hyperfine_target="aarch64-unknown-linux-musl" ;;
9+
*)
10+
echo "Unsupported architecture for hyperfine prebuilt binary: $arch" >&2
11+
exit 1
12+
;;
13+
esac
14+
15+
mkdir -p "$HOME/.local/bin"
16+
17+
echo "Installing hyperfine from GitHub release..." >&2
18+
hyperfine_version="1.20.0"
19+
hyperfine_archive="hyperfine-v${hyperfine_version}-${hyperfine_target}"
20+
hyperfine_url="https://github.com/sharkdp/hyperfine/releases/download/v${hyperfine_version}/${hyperfine_archive}.tar.gz"
21+
curl -fsSL "$hyperfine_url" | tar -xz --strip-components=1 -C "$HOME/.local/bin" "${hyperfine_archive}/hyperfine"

.devcontainer/post-create.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,34 @@ set -euo pipefail
33

44
mkdir -p "$HOME/.local/bin"
55

6-
echo "Installing hyperfine from GitHub release..." >&2
7-
hyperfine_version="1.20.0"
8-
hyperfine_archive_name="hyperfine-v${hyperfine_version}-x86_64-unknown-linux-musl"
9-
hyperfine_url="https://github.com/sharkdp/hyperfine/releases/download/v${hyperfine_version}/${hyperfine_archive_name}.tar.gz"
10-
curl -fsSL "$hyperfine_url" | tar -xz --strip-components=1 -C "$HOME/.local/bin" "${hyperfine_archive_name}/hyperfine"
6+
bash "$(dirname "$0")/install-hyperfine.sh"
7+
8+
arch="$(uname -m)"
119

1210
echo "Installing shellcheck from GitHub release..." >&2
1311
shellcheck_version="0.11.0"
14-
shellcheck_archive_name="shellcheck-v${shellcheck_version}.linux.x86_64"
15-
shellcheck_url="https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/${shellcheck_archive_name}.tar.gz"
12+
case "$arch" in
13+
x86_64) shellcheck_arch="linux.x86_64" ;;
14+
aarch64) shellcheck_arch="linux.aarch64" ;;
15+
*)
16+
echo "Unsupported architecture for shellcheck prebuilt binary: $arch" >&2
17+
exit 1
18+
;;
19+
esac
20+
shellcheck_archive="shellcheck-v${shellcheck_version}.${shellcheck_arch}"
21+
shellcheck_url="https://github.com/koalaman/shellcheck/releases/download/v${shellcheck_version}/${shellcheck_archive}.tar.gz"
1622
curl -fsSL "$shellcheck_url" | tar -xz --strip-components=1 -C "$HOME/.local/bin" "shellcheck-v${shellcheck_version}/shellcheck"
1723

1824
echo "Installing shfmt from GitHub release..." >&2
1925
shfmt_version="3.13.0"
20-
shfmt_url="https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64"
26+
case "$arch" in
27+
x86_64) shfmt_arch="linux_amd64" ;;
28+
aarch64) shfmt_arch="linux_arm64" ;;
29+
*)
30+
echo "Unsupported architecture for shfmt prebuilt binary: $arch" >&2
31+
exit 1
32+
;;
33+
esac
34+
shfmt_url="https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_${shfmt_arch}"
2135
curl -fsSL "$shfmt_url" -o "$HOME/.local/bin/shfmt"
2236
chmod +x "$HOME/.local/bin/shfmt"

0 commit comments

Comments
 (0)