Docker images for Bun applications and services. Bun is a fast, all-in-one JavaScript runtime with built-in package manager, bundler, and transpiler.
1.0/Dockerfile- Bun 1.0 runtime1.1/Dockerfile- Bun 1.1 runtimelatest/Dockerfile- Bun latest (floating version)entrypoint.sh- Container entrypoint with STARTUP variable supportREADME.md- This file
docker run -it \
-e STARTUP="bun run app.ts" \
ghcr.io/nodebytehosting/bun:bun_1.1version: '3.8'
services:
bun-app:
image: ghcr.io/nodebytehosting/bun:bun_1.1
ports:
- "3000:3000/tcp"
environment:
STARTUP: "bun run app.ts"
volumes:
- ./app:/home/container
restart: unless-stoppeddocker build -t bun:1.1 bun/1.1/
docker run -it -e STARTUP="bun run app.ts" bun:1.1| Variable | Default | Description |
|---|---|---|
STARTUP |
- | Bun command to execute (required) |
TZ |
UTC | Timezone (e.g., America/New_York) |
INTERNAL_IP |
auto | Internal container IP (auto-detected) |
BUN_ENV |
- | Set to production for production apps |
USER |
container | Container user (read-only) |
HOME |
/home/container | Container home directory (read-only) |
The entrypoint supports Pterodactyl-style variable substitution:
# Input
STARTUP="bun run app.ts --port {{SERVER_PORT}} --bind {{INTERNAL_IP}}"
# Output
STARTUP="bun run app.ts --port 8080 --bind 172.17.0.2"bun- JavaScript runtime with package manager and bundlercurl- HTTP/HTTPS downloadsgit- Clone repositoriesmake- Build automationpython3- Python support for build scriptsca-certificates- Certificate authoritiestzdata- Timezone data
docker run -it \
-e STARTUP="bun run app.ts" \
-p 3000:3000/tcp \
-v ./app:/home/container \
ghcr.io/nodebytehosting/bun:bun_1.1docker run -it \
-e STARTUP="bun run src/index.ts" \
-p 3000:3000/tcp \
-v ./app:/home/container \
ghcr.io/nodebytehosting/bun:bun_1.1docker run -it \
-e STARTUP="bun run dev" \
ghcr.io/nodebytehosting/bun:bun_1.1docker run -it \
-e STARTUP="bun --eval 'console.log(\"Hello from Bun\")'" \
ghcr.io/nodebytehosting/bun:bun_1.1FROM ghcr.io/nodebytehosting/bun:bun_1.1 as builder
WORKDIR /home/container
COPY . .
RUN bun install
RUN bun build ./src/index.ts --outdir ./dist
FROM ghcr.io/nodebytehosting/bun:bun_1.1
COPY --from=builder /home/container/dist /home/container/dist
COPY --from=builder /home/container/node_modules /home/container/node_modules
ENV STARTUP="bun run dist/index.js"| Version | Released | Status |
|---|---|---|
| 1.0 | September 2023 | Stable |
| 1.1 | Latest | Stable |
| latest | Floating | Always newest |
- Base: Alpine (oven/bun official images)
- Platform: linux/amd64, linux/arm64 (multiarch)
- Includes: Bun runtime, npm/yarn/pnpm compatibility layer
- Speed - ~4x faster than Node.js for many workloads
- All-in-one - Bundler, transpiler, test runner included
- TypeScript native - No configuration needed
- ESM by default - Modern JavaScript syntax out of box
- npm compatible - Works with existing npm packages
- Use
bun runscripts - Faster thannode --loader - Enable production mode - Set
BUN_ENV=production - Pre-build and bundle - Use
bun buildfor optimization - Leverage TypeScript - Native support, no extra tooling
- Use built-in APIs -
Bun.file(),Bun.serve()are optimized
- Check
STARTUPvariable is set - Run
bun --versionto verify Bun is available - Check application logs for errors
- Ensure
bunfig.tomlis present if using custom config - Run
bun installto install dependencies - Check
bun.lockbis committed
- Verify
BUN_ENV=productionis set - Check memory availability:
free -m - Profile with
bun --inspect
- Ensure TypeScript files have
.tsextension - Check
tsconfig.jsonorbunfig.tomlconfiguration - Use
bun buildto pre-compile if needed
To add support for additional Bun versions, create new directories:
mkdir -p bun/1.2 bun/1.3Update each Dockerfile to use the desired Bun base:
FROM oven/bun:1.2-alpine
# ... rest of DockerfileThen add versions to the GitHub Actions workflow matrix:
matrix:
tag:
- "1.0"
- "1.1"
- "1.2"
- "latest"MIT License - See LICENSE file for details
- Issues: https://github.com/NodeByteHosting/game-recipes/issues
- Discord: https://discord.gg/Bg3Sf5fqa4
- Bun Docs: https://bun.sh/docs
- Bun GitHub: https://github.com/oven-sh/bun