Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zhcndoc/bun/llms.txt
Use this file to discover all available pages before exploring further.
Bun provides official Docker images for containerizing applications.
Dockerfile
FROM oven/bun:1 as base
WORKDIR /app
# Install dependencies
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
# Copy application code
COPY . .
# Run the app
EXPOSE 3000
CMD ["bun", "run", "server.ts"]
Build and Run
docker build -t my-bun-app .
docker run -p 3000:3000 my-bun-app
Multi-Stage Build
For smaller images:
FROM oven/bun:1 as builder
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile --production
COPY . .
FROM oven/bun:1-slim
WORKDIR /app
COPY --from=builder /app .
EXPOSE 3000
CMD ["bun", "run", "server.ts"]