Skip to content

Commit 373ff9c

Browse files
committed
build: fix missing tools in the docker image
Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
1 parent 13dce5f commit 373ff9c

2 files changed

Lines changed: 70 additions & 48 deletions

File tree

.github/.devcontainer/Dockerfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,78 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
9696
&& mv -f /tmp/scripts/first-run-notice.txt /usr/local/etc/vscode-dev-containers/ \
9797
&& rm -rf /tmp/scripts
9898

99+
# Install Go
100+
RUN ARCH=$(dpkg --print-architecture) \
101+
&& curl -fsSL "https://golang.org/dl/go1.24.1.linux-${ARCH}.tar.gz" | tar -C /usr/local -xzf -
102+
103+
# Install Node.js
104+
RUN ARCH=$(dpkg --print-architecture) \
105+
&& case $ARCH in \
106+
amd64) NODE_ARCH="x64" ;; \
107+
arm64) NODE_ARCH="arm64" ;; \
108+
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
109+
esac \
110+
&& curl -fsSL "https://nodejs.org/dist/v22.11.0/node-v22.11.0-linux-${NODE_ARCH}.tar.xz" | tar -C /usr/local --strip-components=1 -xJ \
111+
&& npm install -g yarn
112+
113+
# Install kubectl, helm, and minikube
114+
RUN ARCH=$(dpkg --print-architecture) \
115+
&& case $ARCH in \
116+
amd64) K8S_ARCH="amd64" ;; \
117+
arm64) K8S_ARCH="arm64" ;; \
118+
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
119+
esac \
120+
# Install kubectl
121+
&& curl -fsSL "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${K8S_ARCH}/kubectl" -o /usr/local/bin/kubectl \
122+
&& chmod +x /usr/local/bin/kubectl \
123+
# Install helm
124+
&& curl -fsSL "https://get.helm.sh/helm-v3.16.4-linux-${K8S_ARCH}.tar.gz" | tar -C /tmp -xzf - \
125+
&& mv "/tmp/linux-${K8S_ARCH}/helm" /usr/local/bin/helm \
126+
&& rm -rf "/tmp/linux-${K8S_ARCH}" \
127+
# Install minikube
128+
&& curl -fsSL "https://storage.googleapis.com/minikube/releases/latest/minikube-linux-${K8S_ARCH}" -o /usr/local/bin/minikube \
129+
&& chmod +x /usr/local/bin/minikube
130+
131+
# Set up Go environment
132+
ENV PATH="/usr/local/go/bin:$PATH"
133+
ENV GOPATH="/go"
134+
ENV CGO_ENABLED=1
135+
136+
# Create go workspace
137+
RUN mkdir -p /go/bin /go/src /go/pkg
138+
139+
# Create codespace user (matching what devcontainer features would create)
140+
RUN groupadd --gid 1000 codespace \
141+
&& useradd --uid 1000 --gid 1000 -m codespace \
142+
&& echo "codespace ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/codespace \
143+
&& chmod 0440 /etc/sudoers.d/codespace
144+
145+
# Install additional development tools
146+
RUN ARCH=$(dpkg --print-architecture) \
147+
# Install GitHub CLI
148+
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
149+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
150+
&& echo "deb [arch=${ARCH} signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
151+
&& apt-get update \
152+
&& apt-get install -y gh git-lfs \
153+
# Install protoc
154+
&& case $ARCH in \
155+
amd64) PROTOC_ARCH="x86_64" ;; \
156+
arm64) PROTOC_ARCH="aarch_64" ;; \
157+
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
158+
esac \
159+
&& curl -fsSL "https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-${PROTOC_ARCH}.zip" -o /tmp/protoc.zip \
160+
&& unzip /tmp/protoc.zip -d /usr/local \
161+
&& rm /tmp/protoc.zip \
162+
&& apt-get clean \
163+
&& rm -rf /var/lib/apt/lists/*
164+
99165
# Install Atlas for MySQL migration
100166
RUN curl -sSf https://atlasgo.sh | sh -s -- -y
101167

168+
# Switch to codespace user
169+
USER codespace
170+
102171
# Mount for docker-in-docker
103172
VOLUME [ "/var/lib/docker" ]
104173

.github/.devcontainer/devcontainer.json

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,5 @@
55
"context": "."
66
},
77
"remoteUser": "codespace",
8-
"containerUser": "codespace",
9-
"features": {
10-
"ghcr.io/devcontainers/features/common-utils:2.5.3": {
11-
"username": "codespace",
12-
"userUid": "1000",
13-
"userGid": "1000"
14-
},
15-
"ghcr.io/devcontainers-extra/features/protoc-asdf:1.0.7": {
16-
"version": "23.4"
17-
},
18-
"ghcr.io/devcontainers/features/sshd:1.0.10": {
19-
"version": "latest"
20-
},
21-
"ghcr.io/devcontainers/features/git:1.3.4": {
22-
"version": "latest",
23-
"ppa": "false"
24-
},
25-
"ghcr.io/devcontainers/features/git-lfs:1.2.5": {
26-
"version": "latest"
27-
},
28-
"ghcr.io/devcontainers/features/github-cli:1.0.14": {
29-
"version": "latest"
30-
},
31-
"ghcr.io/devcontainers/features/docker-in-docker:2.12.2": {
32-
"version": "latest"
33-
},
34-
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1.2.2": {
35-
"version": "latest"
36-
},
37-
"ghcr.io/devcontainers/features/go:1.3.2": {
38-
"version": "1.24.1"
39-
},
40-
"ghcr.io/devcontainers/features/node:1.6.2": {
41-
"version": "v22.11.0"
42-
},
43-
"./local-features/setup-user": "latest"
44-
},
45-
"overrideFeatureInstallOrder": [
46-
"ghcr.io/devcontainers/features/common-utils",
47-
"ghcr.io/devcontainers/features/git",
48-
"ghcr.io/devcontainers/features/sshd",
49-
"ghcr.io/devcontainers/features/git-lfs",
50-
"ghcr.io/devcontainers/features/github-cli",
51-
"ghcr.io/devcontainers/features/docker-in-docker",
52-
"ghcr.io/devcontainers/features/kubectl-helm-minikube",
53-
"ghcr.io/devcontainers/features/go",
54-
"./local-features/setup-user"
55-
]
8+
"containerUser": "codespace"
569
}

0 commit comments

Comments
 (0)