Detection
migetpacks detects Bun when any of these signals are present:Bun detection runs after backend frameworks (Ruby, Python, Go, etc.) but before Node.js. If your project has both a
bun.lock and a Gemfile, it will be detected as Ruby with Bun available as a secondary buildpack.Version Detection
Bun version is resolved in this order:Build Process
migetpacks generates a multi-stage Dockerfile optimized for Bun:Entry Point Detection
The entry point is automatically detected in this order:.ts/.jsfile referenced inscripts.startofpackage.json- Common file patterns:
index.ts,server.ts,app.ts,main.ts,src/index.ts,src/server.ts,index.js,server.js - Falls back to
index.ts
Build Script
Ifpackage.json contains a "build" script, bun run build is automatically executed after dependency installation. You can override this with the BUILD_COMMAND environment variable.
Lockfile Format
Bun supports two lockfile formats:bun.lock(text-based, newer format)bun.lockb(binary, legacy format)
Run Command
The default run command is determined in this order:
The entry point is detected automatically (see Entry Point Detection above).
Caching
Docker Layer Caching
Dependencies are installed in a separate layer before source code is copied.bun install is only re-run when package.json or bun.lock/bun.lockb changes.
BuildKit Cache Mounts
WhenBUILD_CACHE_DIR is configured, BuildKit cache mounts are used:
Registry Cache
UseCACHE_IMAGE to push/pull BuildKit inline cache layers to a registry for cross-build caching.
DHI Support
Bun is supported with Docker Hardened Images (requires version 1.3.6 or later).
The
-dev variant includes a shell for building. The runtime image is distroless with no shell, providing a minimal attack surface.