Skip to content

Commit 4f21936

Browse files
committed
feat(images): add bun installer and pnpm/yarn to node-22 in build-toolchain
1 parent 7cd46cb commit 4f21936

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

images/scripts/build-toolchain.sh

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Toolchains:
1111
# base — No additional packages (validates rootfs only)
1212
# node-22 — Node.js 22 LTS via NodeSource
13+
# bun — Bun runtime
1314
# python-3.12 — Python 3.12 via deadsnakes PPA
1415
# go-1.22 — Go 1.22 from official tarball
1516

@@ -109,11 +110,16 @@ install_node_22() {
109110
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
110111
apt-get install -y -qq --no-install-recommends nodejs
111112
npm install -g npm@latest 2>/dev/null || true
113+
npm install -g pnpm@latest yarn@latest 2>/dev/null || true
114+
# Enable corepack for managed pnpm/yarn if preferred
115+
corepack enable 2>/dev/null || true
112116
apt-get clean
113117
rm -rf /var/lib/apt/lists/*
114-
echo '--- Node.js version ---'
118+
echo '--- Node.js versions ---'
115119
node --version
116120
npm --version
121+
pnpm --version
122+
yarn --version
117123
"
118124
}
119125

@@ -139,6 +145,26 @@ install_python_312() {
139145
"
140146
}
141147

148+
install_bun() {
149+
echo ">>> Installing Bun + Node.js..."
150+
chroot "$MOUNT_POINT" /bin/bash -c "
151+
export DEBIAN_FRONTEND=noninteractive
152+
# Install Bun
153+
curl -fsSL https://bun.sh/install | bash
154+
mv /root/.bun/bin/bun /usr/local/bin/bun
155+
ln -sf /usr/local/bin/bun /usr/local/bin/bunx
156+
rm -rf /root/.bun
157+
# Install Node.js too — many projects need both
158+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
159+
apt-get install -y -qq --no-install-recommends nodejs
160+
apt-get clean
161+
rm -rf /var/lib/apt/lists/*
162+
echo '--- Versions ---'
163+
bun --version
164+
node --version
165+
"
166+
}
167+
142168
install_go_122() {
143169
echo ">>> Installing Go 1.22..."
144170
chroot "$MOUNT_POINT" /bin/bash -c "
@@ -156,11 +182,12 @@ install_go_122() {
156182

157183
case "$TOOLCHAIN" in
158184
node-22) install_node_22 ;;
185+
bun) install_bun ;;
159186
python-3.12) install_python_312 ;;
160187
go-1.22) install_go_122 ;;
161188
*)
162189
echo "Error: Unknown toolchain '${TOOLCHAIN}'" >&2
163-
echo "Available: base, node-22, python-3.12, go-1.22" >&2
190+
echo "Available: base, node-22, bun, python-3.12, go-1.22" >&2
164191
exit 1
165192
;;
166193
esac

0 commit comments

Comments
 (0)