Script + Dockerfile for building a Docker image based on node:20-alpine with Bun installed
The official over/bun
image is based on Debian and doesn't come with nodejs which currently breaks compatibility with certain use cases.
This image is based on Linux Alpine (which is already being used with most Docker builds for NextJS, Vite, etc.),
comes with bun
+ node
and npm
installed (which is useful for maintaining compatibility in case of issues with Bun)
It also comes with glibc
installed, which is currently a necessary fix to run Bun on Linux Alpine (oven-sh/bun#5545)
# Pull the latest version
FROM squishyu/bun-alpine:latest
Or
# Pull a specific Bun version
FROM squishyu/bun-alpine:1.0.2
docker pull squishyu/bun-alpine
To enter interactive shell:
docker run --rm -it --entrypoint sh squishyu/bun-alpine