docker pull oven/bun:latest && docker run -dit --network matterbridge -p 8283:8283 --name bun-development oven/bun:latest bash
docker exec -it bun-development bash
apt-get update && apt-get install -y git
git clone --depth 1 --single-branch --no-tags --branch dev https://github.com/Luligu/matterbridge.git && cd matterbridge
bun install
bun run build
cd apps/frontend
bun install
bun run build
cd ../..
bun link
matterbridge --docker --logger debug --debug
The image (tag bun 69 MB) includes only Matterbridge, using the latest release published on npm. This image is based on oven/bun:slim. Plugins are not included in the image: they will be reinstalled on first run.
The bun image runs Matterbridge directly from the local source files with Bun runtime.
oven/bun:slim (Debian trixie slim + Bun).bun install --omit=dev bun link| File | Purpose |
|---|---|
docker/Dockerfile.local.bun |
The Bun image definition |
docker/Dockerfile.local.bun.dockerignore |
Per-Dockerfile build context (keeps source, drops .git/chip/scripts/…) |
docker/entrypoint.local.bun.sh |
Entrypoint banner (prints the Bun version) |
npm run docker:build:localbun # build the image (matterbridge:local-bun)
npm run docker:run:localbun # run it (container matterbridge-local-bun, port 8283)
npm run docker:exec:localbun # open a shell in the running container
npm run docker:log:localbun # follow the container logs
The core bridge runs on Bun: it creates its directories, initializes the Matter node storage, and brings up the server node and endpoints. The web frontend is built and served. See the TODO list below for the known limitations.
The approach is to detect if running in bun with isBun() and switch the
package-manager command and global-modules paths to Bun where needed.
bun link (in Dockerfile.bun) registers the
local build as the global matterbridge package — and installs all CLI bins
and their exec bits — so plugins resolve import 'matterbridge'. This is the
full npm link replacement.npm root -g discovery. getGlobalNodeModules() returns
getGlobalBunModules() when running on Bun (there is no bun root -g; the path is
derived from $BUN_INSTALL / ~/.bun).
(npmPrefix.ts, runtimeBun.ts)PluginManager resolves plugins from the Bun
global modules dir when running on Bun. (pluginManager.ts)sudo.
(pluginManager.ts, frontend.ts, backendExpress.ts, spawnCommand.ts)isBun() ? 'bun' : 'npm'.
(matterbridge.ts)--add local plugin. When running on Bun, the plugin is no longer treated as
"local", so the npm link matterbridge step is skipped (bun link already
provides resolution). (matterbridge.ts)node:os and bun:os return username: "unknown" and shell: "unknown"
from os.userInfo(), even though they correctly return the UID, GID, and home
directory. Consequently, Matterbridge sends User: unknown to the frontend
system-information view instead of the container account (for example, root).
Reproduce with bun -e "import * as os from 'bun:os'; console.log(os.userInfo())". // Change: FileStorageDriver.js
async #writeAndMoveFile(filepath, valueOrStream) {
const tmpName = `${filepath}.tmp`;
await writeFile(tmpName, valueOrStream, { encoding: "utf8", flush: true });
await rename(tmpName, filepath);
}