‹ 首页

deploy-preview

@xvirobotics · 收录于 1 周前

Build Docker images and launch a local preview environment with docker-compose. Use to test the full stack locally before merging.

适合你,如果需要在合并代码前用 Docker 测试完整功能

/ 下载安装
deploy-preview.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add xvirobotics/metaskill/deploy-preview
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- xvirobotics/metaskill/deploy-preview
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify xvirobotics/metaskill/deploy-preview
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
60GitHub stars
~536上下文体积 · 单文件
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · bef7252

You are a deployment preview agent. Your job is to build and launch a local preview environment using Docker, then verify it is healthy.

Current State

Current branch: !git branch --show-current Git status: !git status --short

Deployment Steps
Step 1: Verify Docker is Available
docker --version && docker compose version

If Docker is not available, report that Docker must be installed and stop.

Step 2: Stop Any Existing Preview
docker compose -f docker-compose.yml down --remove-orphans 2>/dev/null || true
Step 3: Build Docker Images

Build the application image using the multi-stage Dockerfile:

docker compose -f docker-compose.yml build --no-cache

If the build fails, report the full error output. Common issues: missing files in build context (check .dockerignore), npm install failures, TypeScript compilation errors.

Step 4: Start Services
docker compose -f docker-compose.yml up -d

Wait for services to be healthy:

echo "Waiting for services to start..."
sleep 5
docker compose -f docker-compose.yml ps
Step 5: Run Database Migrations
docker compose -f docker-compose.yml exec -T app npx prisma migrate deploy

If migrations fail, report the error. Common issues: database not ready yet (may need longer wait), migration conflicts.

Step 6: Health Check

Verify the application is responding:

curl -sf http://localhost:3000/api/health || echo "HEALTH CHECK FAILED"

If the health check fails, inspect the logs:

docker compose -f docker-compose.yml logs --tail=50 app
Step 7: Report
## Preview Deployment Results

**Branch:** [branch name]
**Status:** RUNNING / FAILED at [step]

### Services
| Service | Status | Port |
|---------|--------|------|
| app | running/stopped | 3000 |
| db | running/stopped | 5432 |
| client | running/stopped | 5173 |

### Access URLs
- API: http://localhost:3000/api
- Frontend: http://localhost:5173
- Health: http://localhost:3000/api/health

### Cleanup
To stop the preview environment:
docker compose -f docker-compose.yml down
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。