xiaohongshu
xiaohongshu
bun-deploy
Generate optimized Docker images for Bun applications. Use when deploying to containers, minimizing image sizes, setting up CI/CD pipelines, or deploying to Kubernetes.
Full skill instructions
Create optimized Docker images for Bun applications. Bun's small runtime and binary compilation reduce image sizes by 88MB+ compared to Node.js.
For detailed patterns, see:
# Verify Docker is installed
docker --version
# Verify Bun is installed locally
bun --version
# Check if project is ready for deployment
ls -la package.json bun.lockb
Ask the user about their needs:
Choose the appropriate template based on needs:
Standard Multi-Stage (Recommended)
# syntax=docker/dockerfile:1
FROM oven/bun:1-alpine AS deps
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile --production
FROM oven/bun:1-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN bun run build
FROM oven/bun:1-alpine AS runtime
WORKDIR /app
RUN addgroup --system --gid 1001 bunuser && \
adduser --system --uid 1001 bunuser
COPY --from=deps --chown=bunuser:bunuser /app/node_modules ./node_modules
COPY --from=builder --chown=bunuser:bunuser /app/dist ./dist
COPY --from=builder --chown=bunuser:bunuser /app/package.json ./
USER bunuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD bun run healthcheck.ts || exit 1
CMD ["bun", "run", "dist/index.js"]
Minimal Binary (40MB)
For smallest possible images:
FROM oven/bun:1-alpine AS builder
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun build ./src/index.ts --compile --outfile server
FROM gcr.io/distroless/base-debian12
COPY --from=builder /app/server /server
EXPOSE 3000
ENTRYPOINT ["/server"]
For other scenarios (monorepo, database apps, CLI tools, etc.), see dockerfile-templates.md.
node_modules
bun.lockb
dist
*.log
.git
.env
.env.local
tests/
*.test.ts
coverage/
.vscode/
.DS_Store
Dockerfile
docker-compose.yml
Create healthcheck.ts:
#!/usr/bin/env bun
const port = process.env.PORT || 3000;
const healthEndpoint = process.env.HEALTH_ENDPOINT || '/health';
try {
const response = await fetch(`http://localhost:${port}${healthEndpoint}`, {
method: 'GET',
timeout: 2000,
});
if (response.ok) {
process.exit(0);
} else {
console.error(`Health check failed: ${response.status}`);
process.exit(1);
}
} catch (error) {
console.error('Health check error:', error);
process.exit(1);
}
Add health endpoint to your server:
app.get('/health', (req, res) => {
res.json({
status: 'ok',
timestamp: Date.now(),
uptime: process.uptime(),
});
});
# Build image
docker build -t myapp:latest .
# Check image size
docker images myapp:latest
# Run container
docker run -p 3000:3000 myapp:latest
# Test health endpoint
curl http://localhost:3000/health
For Local Development with Docker Compose:
Create docker-compose.yml:
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
environment:
- NODE_ENV=development
depends_on:
- db
- redis
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: pass
POSTGRES_DB: mydb
ports:
- "5432:5432"
redis:
image: redis:7-alpine
ports:
- "6379:6379"
Run with: docker-compose up
For Kubernetes Deployment:
See kubernetes.md for complete manifests including:
For CI/CD:
See ci-cd.md for:
For Multi-Platform (ARM64 + AMD64):
See multi-platform.md for:
Add Docker scripts:
{
"scripts": {
"docker:build": "docker build -t myapp:latest .",
"docker:run": "docker run -p 3000:3000 myapp:latest",
"docker:dev": "docker-compose up",
"docker:clean": "docker system prune -af"
}
}
Bun produces significantly smaller images:
| Configuration | Size | Use Case |
|---|---|---|
| Bun Binary (distroless) | ~40 MB | Production (minimal) |
| Bun Alpine | ~90 MB | Production (standard) |
| Node.js Alpine | ~180 MB | Baseline comparison |
88MB+ savings with Bun!
docker scan myapp:latestoven/bun is officialLayer caching:
# Copy dependencies first (changes less often)
COPY package.json bun.lockb ./
RUN bun install
# Copy source code last (changes more often)
COPY . .
RUN bun run build
Reduce layer count:
# Combine RUN commands
RUN bun install && \
bun run build && \
rm -rf tests/
Minimize final image:
# Only copy what's needed in runtime
COPY --from=builder /app/dist ./dist
# Don't copy: src/, tests/, .git/, node_modules (if using binary)
After basic deployment:
For detailed implementations, see the reference files linked above.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience