Skip to content

build(base)!: slim base image from 1.97 GB to 1.4 GB - #140

Merged
TomGrozev merged 2 commits into
masterfrom
chore/slim-base-image
Oct 17, 2026
Merged

TomGrozev merged 2 commits into
masterfrom
chore/slim-base-image

Conversation

@agent-007-hq

Copy link
Copy Markdown
Collaborator

Summary

Base image shrinks from 1.97 GB to 1.4 GB (arm64, uncompressed). Rust and Elixir build FROM it, so they shrink by the same amount.

 devcontainer-base
-  opencode binary                      185 MB
-  ffmpeg + codec deps                  184 MB
-  nodejs (NodeSource apt)              230 MB
+  npm/npx standalone tarball           ~16 MB
+  node → Bun (wrapper + symlink)        ~0 MB
flowchart LR
  T["npm / npx / #!/usr/bin/env node"] --> W["/usr/local/bin/node<br/>sh wrapper"]
  W -- "-v / --version" --> V["prints process.version"]
  W -- "everything else" --> S["/usr/local/lib/bun-node/node<br/>symlink, argv0 = node"]
  V --> S
  S --> B["bun (Node mode)"]
Loading

Bun enters Node mode only when it is run as node. In that mode it rejects --version/-v, so the wrapper answers those itself.

The Coder template loses its OpenCode and Start opencode apps. ompweb, miao and zellij are unchanged.

Reading order:

  1. images/base/Dockerfile
  2. docker-bake.hcl
  3. .github/workflows/pr.yml
  4. .github/workflows/release.yml
  5. scripts/gen-readme-versions.sh
  6. coder-template/main.tf
  7. README.md
  8. coder-template/README.md

Evidence

  • Before: ghcr.io/tomgrozev/devcontainer-base:latest → 1.97GB
    After: docker buildx bake base (arm64) → 1.4GB

Smoke run on the new image:

Check Result
node --version / node -v / node -e v26.3.0 / v26.3.0 / ok
npm --version, npx --version, npm i -g as dev 11.19.0; global bin in ~/.local/bin runs
native addon bufferutil installs and loads
ompweb via npx -y @kahme247/ompweb --port 30177 HTTP 200, spawns omp
npx @hyperlogue/r3 --help exit 0
Playwright chromium-headless-shell 0 missing libs, renders a page
opencode, ffmpeg absent
tofu validate on coder-template/ valid

Merge Danger

Door: two-way

Revert restores node, ffmpeg and OpenCode. Workspaces pick up the change on their next image pull.

Blast Radius: workspaces

  • npm init fails under Bun (mod.require is not a function, same on npm 12.2.0). install/run/pack/view/npx work. Node-only CLI flags that Bun lacks will also fail.
  • The OpenCode apps disappear from workspaces once the template is pushed.
  • Bug already in the current image, not fixed here: the Restart ompweb pkill -f '@kahme247/ompweb' only kills the npx parent, and the server keeps running.

Drop OpenCode (185 MB), ffmpeg and its codec deps (184 MB), and the
NodeSource Node.js package (230 MB).

`node` is now Bun: /usr/local/bin/node is a sh wrapper that answers
-v/--version (Bun's Node mode rejects them) and otherwise execs a `node`
symlink to bun, since Bun enters Node mode only when argv[0] is `node`.
npm/npx come from the standalone registry tarball, pinned by NPM_VERSION.

Known gap: `npm init` fails under Bun (mod.require is not a function);
install/run/pack/view/npx work.

BREAKING CHANGE: the Coder template no longer offers the OpenCode and
Start opencode apps; the opencode CLI and ffmpeg are gone from all images;
NODE_MAJOR and OPENCODE_VERSION build args are removed.
Co-authored-by: Tom Grozev <1491414+TomGrozev@users.noreply.github.com>
Comment thread images/base/Dockerfile
&& ln -sf /usr/local/bin/bun /usr/local/lib/bun-node/node \
&& printf '%s\n' \
'#!/bin/sh' \
'case "$1" in -v|--version) exec /usr/local/lib/bun-node/node -p process.version ;; esac' \

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node is a sh wrapper so --version/-v work under Bun, which adds a tiny sh startup to every node call. Fine, or would you rather have real node back?

Comment thread images/base/Dockerfile Resolved
Comment thread coder-template/main.tf Resolved
@TomGrozev
TomGrozev merged commit f92bd8d into master Oct 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants