Skip to content

Commit 2c75eb4

Browse files
committed
devcontainer: drop common-utils feature
The MS Go devcontainer image (2.1-1.26) already ships the vscode user, sudo, git, curl, zsh, oh-my-zsh, etc. The common-utils feature re-runs the same install (visible as a 2-min apt-get against deb.debian.org) for no behavioral change. Removing it cuts cold-start from ~3min to ~30s.
1 parent c9a7706 commit 2c75eb4

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM mcr.microsoft.com/devcontainers/go:2.1-1.26
2+
COPY --from=jb-devcontainer-features-762b7b096d19fd5170c4177074e82d13 /tmp/jb-devcontainer-features /tmp/jb-devcontainer-features/
3+
ENV PATH="/usr/local/share/nvm/current/bin:/usr/local/go/bin:/go/bin:/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
4+
ENV GOLANG_VERSION="1.26.4"
5+
ENV GOTOOLCHAIN="local"
6+
ENV GOPATH="/go"
7+
ENV GOROOT="/usr/local/go"
8+
ENV NVM_DIR="/usr/local/share/nvm"
9+
ENV NVM_SYMLINK_CURRENT="true"
10+
ENV _CONTAINER_USER="root"
11+
ENV _CONTAINER_USER_HOME="/root"
12+
ENV _REMOTE_USER="vscode"
13+
ENV _REMOTE_USER_HOME="/home/vscode"
14+
15+
USER root
16+
RUN chmod -R 0755 /tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-common-utils-2 \
17+
&& cd /tmp/jb-devcontainer-features/ghcr.io-devcontainers-features-common-utils-2 \
18+
&& chmod +x ./devcontainer-feature-setup.sh \
19+
&& ./devcontainer-feature-setup.sh

.devcontainer/devcontainer.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
"--security-opt=apparmor=unconfined"
1717
],
1818

19-
"features": {
20-
"ghcr.io/devcontainers/features/common-utils:2": {}
21-
},
22-
19+
// No `features` block: the MS Go devcontainer image already ships the
20+
// vscode user, sudo, git, curl, zsh, oh-my-zsh, and everything else
21+
// common-utils would have installed — adding the feature just re-runs
22+
// a 2-minute apt-get for nothing (and stalls behind deb.debian.org on
23+
// slow networks).
24+
//
2325
// libbtrfs-dev lets you build with `-tags btrfs` (the optional fast-path
2426
// backend that needs cgo); the default static build needs nothing.
25-
// sudo: devcontainer lifecycle commands run as remoteUser (vscode), not root.
26-
// The common-utils feature gives vscode passwordless sudo.
27+
// `sudo` because lifecycle commands run as remoteUser (vscode), and the
28+
// base image's vscode user has passwordless sudo configured.
2729
"postCreateCommand": "sudo apt-get update && sudo apt-get install -y -qq libbtrfs-dev make",
2830
// Show the Makefile target list every time the container is attached, so a new
2931
// contributor immediately sees what they can do (build / test / verify / demo).

0 commit comments

Comments
 (0)