Token导航 LogoToken导航TokenDH.com
运维和基础设施敏感数据github未标认证来源可访问clear审计提醒

bun-deployBun 部署

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

973

周安装

39

GitHub Stars

3

下载量

315
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:bun-deploy(Bun 部署)
来源仓库:https://github.com/daleseo/bun-skills
仓库路径:skills/bun-deploy
安装命令:
npx skills add https://github.com/daleseo/bun-skills --skill bun-deploy
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/daleseo/bun-skills --skill bun-deploy

简介

用于创建优化的 Bun Docker 镜像进行部署。

  • 相比 Node.js 减少约 88MB+ 镜像体积。
  • 提供多种基础镜像变体(slim/alpine/distroless)。
  • 包含 Kubernetes 和 CI/CD 流水线集成指南。
  • 需提前验证 Docker 和 Bun 的安装状态。bun-deploy 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Bun Docker Deployment

Create optimized Docker images for Bun applications. Bun's small runtime and binary compilation reduce image sizes by 88MB+ compared to Node.js.

Quick Reference

For detailed patterns, see:

Core Workflow

1. Check Prerequisites

# 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

2. Determine Deployment Strategy

Ask the user about their needs:

  • Application Type: Web server, API, worker, or CLI
  • Image Size Priority: Minimal size (40MB binary) vs. debugging tools (90MB Alpine)
  • Platform: Single platform or multi-platform (AMD64 + ARM64)
  • Orchestration: Docker Compose, Kubernetes, or standalone containers

3. Create Production Dockerfile

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.

4. Create.dockerignore

node_modules
bun.lockb
dist
*.log
.git
.env
.env.local
tests/
*.test.ts
coverage/
.vscode/
.DS_Store
Dockerfile
docker-compose.yml

5. Create Health Check Script

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(),
  });
});

6. Build and Test Image

# 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

7. Setup for Environment

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:

  • Deployment configuration
  • Service and Ingress
  • Secrets and ConfigMaps
  • Horizontal Pod Autoscaling
  • Resource limits optimized for Bun

For CI/CD:

See ci-cd.md for:

  • GitHub Actions workflow
  • GitLab CI configuration
  • Build and push scripts
  • Automated deployments

For Multi-Platform (ARM64 + AMD64):

See multi-platform.md for:

  • Multi-platform Dockerfile
  • Buildx configuration
  • Testing on different architectures

8. Update package.json

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"
  }
}

Image Size Comparison

Bun produces significantly smaller images:

ConfigurationSizeUse Case
Bun Binary (distroless)~40 MBProduction (minimal)
Bun Alpine~90 MBProduction (standard)
Node.js Alpine~180 MBBaseline comparison

88MB+ savings with Bun!

Security Best Practices

  1. Use non-root user (included in Dockerfiles above)
  2. Scan for vulnerabilities: docker scan myapp:latest
  3. Use official base images: oven/bun is official
  4. Keep images updated: Rebuild regularly with latest Bun
  5. Never hardcode secrets: Use environment variables or secret managers

Optimization Tips

Layer 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)

Completion Checklist

  • ✅ Dockerfile created (multi-stage or binary)
  • ✅.dockerignore configured
  • ✅ Health check implemented
  • ✅ Non-root user configured
  • ✅ Image built and tested locally
  • ✅ Image size verified (<100MB for Alpine, <50MB for binary)
  • ✅ Environment configuration ready (docker-compose or K8s)
  • ✅ CI/CD pipeline configured (if needed)

Next Steps

After basic deployment:

  1. Monitoring: Add Prometheus metrics endpoint
  2. Logging: Configure structured logging
  3. Secrets: Set up proper secret management
  4. Scaling: Configure horizontal pod autoscaling (K8s)
  5. CI/CD: Automate builds and deployments
  6. Multi-region: Deploy to multiple regions for redundancy

For detailed implementations, see the reference files linked above.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.4%
按下载量换算96

Antigravity

23.97%
按下载量换算76

Gemini CLI

17.76%
按下载量换算56

Cursor

13.86%
按下载量换算44

OpenCode

7.65%
按下载量换算24

Codex

3.71%
按下载量换算12

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills