Skip to content

Commit 9641a42

Browse files
committed
build: update dev container dependencies
Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
1 parent e629673 commit 9641a42

5 files changed

Lines changed: 85 additions & 113 deletions

File tree

.github/.devcontainer/Dockerfile

Lines changed: 51 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,79 @@ FROM ubuntu:jammy
22

33
COPY first-run-notice.txt /tmp/scripts/
44

5-
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
6-
# Restore man command
7-
&& yes | unminimize 2>&1
8-
9-
ENV LANG="C.UTF-8"
5+
ENV LANG="C.UTF-8" \
6+
DEBIAN_FRONTEND=noninteractive \
7+
SHELL=/bin/bash \
8+
DOCKER_BUILDKIT=1
109

11-
# Install basic build tools
10+
# Install all packages in a single RUN command to reduce layers
1211
RUN apt-get update \
1312
&& apt-get upgrade -y \
14-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
13+
&& apt-get install -y --no-install-recommends \
14+
# Essential build tools
1515
make \
16-
unzip \
17-
# The tools in this package are used when installing packages for Python
1816
build-essential \
19-
swig3.0 \
20-
# Required for Microsoft SQL Server
21-
unixodbc-dev \
22-
# Required for PostgreSQL
23-
libpq-dev \
24-
# Required for mysqlclient
25-
default-libmysqlclient-dev \
26-
# Required for ts
27-
moreutils \
28-
rsync \
17+
cmake \
18+
curl \
19+
git \
20+
unzip \
2921
zip \
30-
libgdiplus \
22+
rsync \
3123
jq \
24+
xz-utils \
25+
# Database drivers (only what's actually needed)
26+
libpq-dev \
27+
default-libmysqlclient-dev \
28+
sqlite3 \
29+
libsqlite3-dev \
30+
# Development tools
31+
python3-dev \
3232
python3-pip \
33-
#.NET Core related pre-requisites
34-
libc6 \
35-
libgcc1 \
36-
libgssapi-krb5-2 \
37-
libncurses6 \
38-
liblttng-ust1 \
33+
vim \
34+
protobuf-compiler \
35+
# Essential libraries
3936
libssl-dev \
37+
libgcc1 \
4038
libstdc++6 \
4139
zlib1g \
4240
libuuid1 \
43-
libunwind8 \
44-
sqlite3 \
45-
libsqlite3-dev \
46-
software-properties-common \
47-
tk-dev \
4841
uuid-dev \
49-
curl \
50-
gettext \
42+
&& apt-get autoremove -y \
43+
&& apt-get clean -y \
5144
&& rm -rf /var/lib/apt/lists/* \
52-
# This is the folder containing 'links' to benv and build script generator
53-
&& apt-get update \
54-
&& apt-get upgrade -y \
55-
&& add-apt-repository universe \
56-
&& rm -rf /var/lib/apt/lists/*
57-
58-
# Verify expected build and debug tools are present
59-
RUN apt-get update \
60-
&& apt-get -y install build-essential cmake cppcheck valgrind clang clang-format lldb llvm gdb python3-dev \
61-
# Install tools and shells not in common script
62-
&& apt-get install -yq vim vim-doc xtail software-properties-common libsecret-1-dev \
63-
# Install additional tools (useful for 'puppeteer' project)
64-
&& apt-get install -y --no-install-recommends libnss3 libnspr4 libatk-bridge2.0-0 libatk1.0-0 libx11-6 libpangocairo-1.0-0 \
65-
libx11-xcb1 libcups2 libxcomposite1 libxdamage1 libxfixes3 libpango-1.0-0 libgbm1 libgtk-3-0 \
66-
# Clean up
67-
&& apt-get autoremove -y && apt-get clean -y \
6845
# Move first run notice to right spot
6946
&& mkdir -p "/usr/local/etc/vscode-dev-containers/" \
70-
&& mv -f /tmp/scripts/first-run-notice.txt /usr/local/etc/vscode-dev-containers/
47+
&& mv -f /tmp/scripts/first-run-notice.txt /usr/local/etc/vscode-dev-containers/ \
48+
&& rm -rf /tmp/scripts
7149

72-
# Default to bash shell (other shells available at /usr/bin/fish and /usr/bin/zsh)
73-
ENV SHELL=/bin/bash \
74-
DOCKER_BUILDKIT=1
50+
# Install Go
51+
RUN curl -fsSL https://golang.org/dl/go1.24.6.linux-$(dpkg --print-architecture).tar.gz | tar -C /usr/local -xzf -
52+
53+
# Install Node.js and npm manually (more reliable for multi-platform builds)
54+
RUN ARCH=$(dpkg --print-architecture) \
55+
&& case $ARCH in \
56+
amd64) NODE_ARCH="x64" ;; \
57+
arm64) NODE_ARCH="arm64" ;; \
58+
*) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
59+
esac \
60+
&& 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 \
61+
&& npm install -g yarn
62+
63+
# Set up Go environment
64+
ENV PATH=$PATH:/usr/local/go/bin
65+
ENV GOPATH=/go
66+
ENV CGO_ENABLED=1
7567

76-
# Remove scripts now that we're done with them
77-
RUN apt-get clean -y && rm -rf /tmp/scripts
68+
# Create go workspace
69+
RUN mkdir -p /go/bin /go/src /go/pkg
70+
71+
# Install Atlas for MySQL migration
72+
RUN curl -sSf https://atlasgo.sh | sh -s -- -y
7873

7974
# Mount for docker-in-docker
8075
VOLUME [ "/var/lib/docker" ]
8176

82-
# Fire Docker/Moby script if needed
83-
ENTRYPOINT [ "/usr/local/share/docker-init.sh", "/usr/local/share/ssh-init.sh"]
77+
# Simple entrypoint for dev container
8478
CMD [ "sleep", "infinity" ]
8579

8680
# [Optional] Install debugger for development of Codespaces - Not in resulting image by default
@@ -90,5 +84,3 @@ RUN if [ -z $DeveloperBuild ]; then \
9084
else \
9185
curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l /vsdbg ; \
9286
fi
93-
# Install the Atlas for MySQL migration
94-
RUN curl -sSf https://atlasgo.sh | sh -s -- -y

.github/.devcontainer/devcontainer.json

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,30 @@
77
"remoteUser": "codespace",
88
"containerUser": "codespace",
99
"features": {
10-
"ghcr.io/devcontainers/features/common-utils:2.5.2": {
10+
"ghcr.io/devcontainers/features/common-utils:2.5.3": {
1111
"username": "codespace",
1212
"userUid": "1000",
1313
"userGid": "1000"
1414
},
15-
"ghcr.io/devcontainers-extra/features/protoc-asdf:1": {
16-
"version": "23.4"
17-
},
18-
"ghcr.io/devcontainers/features/sshd:1": {
15+
"ghcr.io/devcontainers/features/sshd:1.0.10": {
1916
"version": "latest"
2017
},
21-
"ghcr.io/devcontainers/features/git:1.3.2": {
18+
"ghcr.io/devcontainers/features/git:1.3.4": {
2219
"version": "latest",
2320
"ppa": "false"
2421
},
25-
"ghcr.io/devcontainers/features/git-lfs:1.2.3": {
22+
"ghcr.io/devcontainers/features/git-lfs:1.2.5": {
2623
"version": "latest"
2724
},
28-
"ghcr.io/devcontainers/features/github-cli:1.0.13": {
25+
"ghcr.io/devcontainers/features/github-cli:1.0.14": {
2926
"version": "latest"
3027
},
31-
"ghcr.io/devcontainers/features/docker-in-docker:2.12.0": {
28+
"ghcr.io/devcontainers/features/docker-in-docker:2.12.2": {
3229
"version": "latest"
3330
},
34-
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1.2.0": {
31+
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1.2.2": {
3532
"version": "latest"
3633
},
37-
"ghcr.io/devcontainers/features/go:1.3.1": {
38-
"version": "1.24.1"
39-
},
40-
"ghcr.io/devcontainers/features/node:1.6.1": {
41-
"version": "v22.8.0"
42-
},
4334
"./local-features/setup-user": "latest"
4435
},
4536
"overrideFeatureInstallOrder": [
@@ -50,7 +41,6 @@
5041
"ghcr.io/devcontainers/features/github-cli",
5142
"ghcr.io/devcontainers/features/docker-in-docker",
5243
"ghcr.io/devcontainers/features/kubectl-helm-minikube",
53-
"ghcr.io/devcontainers/features/go",
5444
"./local-features/setup-user"
5545
]
5646
}

.github/.devcontainer/local-features/setup-user/devcontainer-feature.json

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
{
22
"id": "setup-user",
3-
"name": "Setup user configs",
3+
"name": "Setup user configs for Go/Node.js development",
44
"containerEnv": {
5-
"RUBY_HOME": "/usr/local/rvm/rubies/default",
6-
"JAVA_ROOT": "/home/codespace/java",
7-
"NODE_ROOT": "/home/codespace/nvm",
8-
"PHP_ROOT": "/home/codespace/.php",
9-
"PYTHON_ROOT": "/home/codespace/.python",
10-
"RUBY_ROOT": "/home/codespace/.ruby",
11-
"MAVEN_ROOT": "/home/codespace/.maven",
12-
"HUGO_ROOT": "/home/codespace/.hugo",
13-
"DOTNET_SKIP_FIRST_TIME_EXPERIENCE": "1",
14-
"NUGET_XMLDOC_MODE": "skip",
15-
"ORYX_ENV_TYPE": "vsonline-present",
16-
"PYTHONIOENCODING": "UTF-8",
17-
"NPM_GLOBAL": "/home/codespace/.npm-global",
18-
"NVS_HOME": "/home/codespace/.nvs",
19-
"RVM_PATH": "/usr/local/rvm",
20-
"RAILS_DEVELOPMENT_HOSTS": ".githubpreview.dev,.preview.app.github.dev,.app.github.dev",
215
"GOROOT": "/usr/local/go",
22-
"JUPYTERLAB_PATH": "/home/codespace/.local/bin",
23-
"PATH": "/home/codespace/.dotnet:/home/codespace/nvm/current/bin:/home/codespace/.php/current/bin:/home/codespace/.python/current/bin:/home/codespace/java/current/bin:/home/codespace/.ruby/current/bin:/home/codespace/.local/bin:${PATH}"
6+
"GOPATH": "/go",
7+
"NPM_GLOBAL": "/home/codespace/.npm-global",
8+
"PATH": "/usr/local/go/bin:/go/bin:/usr/local/bin:/home/codespace/.local/bin:${PATH}"
249
},
2510
"install": {
2611
"app": "",
Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22
#-------------------------------------------------------------------------------------------------------------
3-
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
3+
# Setup user configuration for Bucketeer development environment
54
#-------------------------------------------------------------------------------------------------------------
65

76
USERNAME=${USERNAME:-"codespace"}
@@ -13,27 +12,29 @@ if [ "$(id -u)" -ne 0 ]; then
1312
exit 1
1413
fi
1514

16-
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
15+
# Ensure that login shells get the correct path
1716
rm -f /etc/profile.d/00-restore-env.sh
18-
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" >/etc/profile.d/00-restore-env.sh
17+
echo "export PATH=/usr/local/go/bin:/go/bin:/usr/local/bin:/home/${USERNAME}/.local/bin:\$PATH" >/etc/profile.d/00-restore-env.sh
18+
echo "export GOPATH=/go" >>/etc/profile.d/00-restore-env.sh
19+
echo "export GOROOT=/usr/local/go" >>/etc/profile.d/00-restore-env.sh
1920
chmod +x /etc/profile.d/00-restore-env.sh
2021

2122
export DEBIAN_FRONTEND=noninteractive
2223

23-
sudo_if() {
24-
COMMAND="$*"
25-
if [ "$(id -u)" -eq 0 ] && [ "$USERNAME" != "root" ]; then
26-
su - "$USERNAME" -c "$COMMAND"
27-
else
28-
"$COMMAND"
29-
fi
30-
}
31-
24+
# Set up user home directory permissions
3225
HOME_DIR="/home/${USERNAME}/"
33-
chown -R ${USERNAME}:${USERNAME} ${HOME_DIR}
34-
chmod -R g+r+w "${HOME_DIR}"
35-
find "${HOME_DIR}" -type d | xargs -n 1 chmod g+s
26+
if [ -d "${HOME_DIR}" ]; then
27+
chown -R ${USERNAME}:${USERNAME} ${HOME_DIR}
28+
chmod -R g+r+w "${HOME_DIR}"
29+
find "${HOME_DIR}" -type d | xargs -n 1 chmod g+s
30+
fi
31+
32+
# Create npm global directory for user
33+
NPM_GLOBAL_DIR="/home/${USERNAME}/.npm-global"
34+
mkdir -p "${NPM_GLOBAL_DIR}"
35+
chown -R ${USERNAME}:${USERNAME} "${NPM_GLOBAL_DIR}"
3636

37-
echo "Defaults secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin:/usr/local/share:/home/${USERNAME}/.local/bin:${PATH}\"" >>/etc/sudoers.d/$USERNAME
37+
# Configure sudo PATH
38+
echo "Defaults secure_path=\"/usr/local/go/bin:/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/${USERNAME}/.local/bin\"" >>/etc/sudoers.d/$USERNAME
3839

39-
echo "Done!"
40+
echo "User setup complete!"

.github/workflows/devcontainer-image-build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,24 @@ jobs:
1414
steps:
1515
- name: Checkout (GitHub)
1616
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
1718
- name: Set up QEMU for multi-architecture builds
1819
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
1920
with:
2021
platforms: linux/amd64,linux/arm64
22+
2123
- name: Setup Docker buildx for multi-architecture builds
2224
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
2325
with:
2426
use: true
27+
2528
- name: Login to GitHub Container Registry
2629
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
2730
with:
2831
registry: ghcr.io
2932
username: ${{ github.repository_owner }}
3033
password: ${{ secrets.GITHUB_TOKEN }}
34+
3135
- name: Build and release devcontainer Multi-Platform
3236
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3
3337
env:

0 commit comments

Comments
 (0)