bun-docker

Containerize Bun applications with Dockerfiles, multi-stage builds, and Docker Compose configurations.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-docker-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-docker
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/bun-docker
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-docker-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Deploying Bun applications in Docker requires choosing the right base image, structuring multi-stage builds, managing lockfiles, and handling production concerns like non-root users and health checks, which is error-prone without a reference. ## Core Features & Use Cases - Dockerfile Templates: Provides basic, multi-stage production, Alpine, distroless, and compiled-binary Dockerfile patterns using official oven/bun images. - Docker Compose Setups: Includes production compose files with PostgreSQL and development setups with hot-reload via volume mounts. - Production Hardening: Covers caching optimization, .dockerignore, health checks, environment variables, non-root execution, and secure dependency installation. - Use Case: You have a Bun HTTP server and need a slim production image. Use the multi-stage build pattern to compile the app, copy only production dependencies, and run as the bun user on oven/bun:1-slim. ## Quick Start Ask the assistant to generate a production multi-stage Dockerfile for your Bun application using the official oven/bun image.

Frequently Asked Questions about bun-docker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What Docker image should I use for Bun?

Use the official oven/bun image. Variants include oven/bun:latest (~100MB), oven/bun:slim (~80MB), oven/bun:alpine (~50MB), and oven/bun:distroless (~60MB). Pin a specific version like oven/bun:1.0.0 for reproducible builds.

How do I set up hot reload for Bun in Docker Compose?

Create a Dockerfile.dev based on oven/bun:1, then in docker-compose mount your source directory and package.json as volumes and run bun --hot run src/index.ts. Code changes on the host trigger reloads inside the container without rebuilding.

Can I compile a Bun app to a binary inside Docker?

Yes. In a builder stage run bun build src/index.ts --compile --outfile=server, then copy the binary into a minimal runtime image such as ubuntu:22.04 or a distroless base. The final image needs no Bun runtime installed.

Why does my Bun Docker build fail with bun.lockb not found?

The error means the lockfile is missing from the build context. Run bun install locally to generate bun.lockb, and make sure your .dockerignore does not exclude it, since the Dockerfile copies it for frozen-lockfile installs.

How do I reduce Bun Docker image size?

Use multi-stage builds to separate dependency installation, building, and runtime, and choose slim, alpine, or distroless base variants. Copy only production dependencies and built assets into the final stage, and maintain a proper .dockerignore file.