Matterbridge Logo   Matterbridge on Bun

matterbridge.io Docker Image Size ESM ESM


Bun local development in container

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

inside the container clone, build and run matterbridge

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

Bun docker hub image (experimental — for test and development only)

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.

Bun local image (experimental — for test and development only)

The bun image runs Matterbridge directly from the local source files with Bun runtime.

Files

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)

Scripts

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

Status

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.


Bun port status

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.

Done

Known issue

  // Change: FileStorageDriver.js
  async #writeAndMoveFile(filepath, valueOrStream) {
    const tmpName = `${filepath}.tmp`;
    await writeFile(tmpName, valueOrStream, { encoding: "utf8", flush: true });
    await rename(tmpName, filepath);
  }

TODO