sealos-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSealos Deploy
Sealos 部署工具
Deploy any GitHub project to Sealos Cloud — from source code to running application, one command.
只需一条命令,即可将任意GitHub项目部署到Sealos Cloud:从源代码到可运行的应用,一步到位。
kubectl Safety Rules (all phases)
kubectl 安全规则(全阶段适用)
All kubectl commands MUST use the Sealos kubeconfig:
KUBECONFIG=~/.sealos/kubeconfig kubectl --insecure-skip-tls-verifySystem tool installation requires user confirmation. If , , or is missing and the skill can install it for the current platform, ask first and only run the install command after the user explicitly replies .
dockerghkubectlykubectl delete⚠️ 即将删除 <resource kind>/<resource name>,数据不可恢复。确认?(y/n)Only proceed after user confirms. This applies even if the pipeline logic suggests deletion — always ask first.
所有kubectl命令必须使用Sealos的kubeconfig:
KUBECONFIG=~/.sealos/kubeconfig kubectl --insecure-skip-tls-verify系统工具安装需要用户确认。如果缺少、或且本工具可在当前平台安装,需要先询问用户,只有当用户明确回复后才可运行安装命令。
dockerghkubectlykubectl delete⚠️ 即将删除 <resource kind>/<resource name>,数据不可恢复。确认?(y/n)仅在用户确认后才可继续操作。即便流水线逻辑要求执行删除,也必须先询问用户。
Usage
使用方法
/sealos-deploy <github-url>
/sealos-deploy # deploy current project
/sealos-deploy <local-path>/sealos-deploy <github-url>
/sealos-deploy # 部署当前项目
/sealos-deploy <local-path>Quick Start
快速开始
Execute the modules in order:
- — Environment checks & Sealos auth
modules/preflight.md - — Full deployment pipeline (Phase 1–6)
modules/pipeline.md
按顺序执行以下模块:
- — 环境检查与Sealos身份认证
modules/preflight.md - — 完整部署流水线(第1-6阶段)
modules/pipeline.md
Logging
日志规范
Every run MUST write a log file at .
~/.sealos/logs/deploy-<YYYYMMDD-HHmmss>.logAt the very start of execution, create the log file once:
bash
mkdir -p ~/.sealos/logs
LOG_FILE=~/.sealos/logs/deploy-$(date +%Y%m%d-%H%M%S).log
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Deploy started" > "$LOG_FILE"Important: create the log file ONLY ONCE at the start. All subsequent writes MUST append () to this same . Do NOT create a second log file.
>>$LOG_FILEAt each phase boundary, append a log entry to the same file with Bash :
>>[2026-03-05 14:30:01] === Phase 0: Preflight ===
[2026-03-05 14:30:01] Docker: ✓ 27.5.1
[2026-03-05 14:30:01] Node.js: ✓ 22.12.0
[2026-03-05 14:30:02] Sealos auth: ✓ (region: <REGION from config.json>)
[2026-03-05 14:30:02] Project: /Users/dev/myapp (github: https://github.com/owner/repo)
[2026-03-05 14:30:03] === Phase 1: Assess ===
[2026-03-05 14:30:03] Score: 9/12 (good)
[2026-03-05 14:30:03] Language: python, Framework: fastapi, Port: 8000
[2026-03-05 14:30:03] Decision: CONTINUE
[2026-03-05 14:30:04] === Phase 2: Detect Image ===
[2026-03-05 14:30:05] Docker Hub: owner/repo:latest (arm64 only, no amd64)
[2026-03-05 14:30:05] GHCR: not found
[2026-03-05 14:30:05] Decision: no amd64 image → continue to Phase 3
[2026-03-05 14:30:06] === Phase 3: Dockerfile ===
[2026-03-05 14:30:06] Existing Dockerfile: none
[2026-03-05 14:30:07] Generated: python-fastapi template, port 8000
[2026-03-05 14:30:08] === Phase 4: Build & Push ===
[2026-03-05 14:30:08] Registry: ghcr (auto-detected via gh CLI)
[2026-03-05 14:30:30] Build: ✓ ghcr.io/zhujingyang/repo:20260305-143022
[2026-03-05 14:30:30] IMAGE_REF=ghcr.io/zhujingyang/repo:20260305-143022
[2026-03-05 14:30:31] === Phase 5: Template ===
[2026-03-05 14:30:32] Output: .sealos/template/index.yaml
[2026-03-05 14:30:33] === Phase 6: Deploy ===
[2026-03-05 14:30:33] Deploy URL: https://template.<REGION_DOMAIN>/api/v2alpha/templates/raw
[2026-03-05 14:30:35] Status: 201 — deployed successfully
[2026-03-05 14:30:35] === DONE ===On error, log the error details before stopping:
[2026-03-05 14:30:10] === ERROR ===
[2026-03-05 14:30:10] Phase: 4 (Build & Push)
[2026-03-05 14:30:10] Error: docker buildx build failed — "npm ERR! Missing script: build"
[2026-03-05 14:30:10] Retry: 1/3At the very end, tell the user where the log is:
Log saved to: ~/.sealos/logs/deploy-20260305-143001.log每次运行必须在路径下生成日志文件。
~/.sealos/logs/deploy-<YYYYMMDD-HHmmss>.log执行最开始,一次性创建日志文件:
bash
mkdir -p ~/.sealos/logs
LOG_FILE=~/.sealos/logs/deploy-$(date +%Y%m%d-%H%M%S).log
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Deploy started" > "$LOG_FILE"重要提示:仅在启动时创建一次日志文件,所有后续写入必须采用追加()的方式写入同一个,禁止创建第二个日志文件。
>>$LOG_FILE每个阶段切换时,使用Bash的命令向同一个日志文件追加日志条目:
>>[2026-03-05 14:30:01] === Phase 0: Preflight ===
[2026-03-05 14:30:01] Docker: ✓ 27.5.1
[2026-03-05 14:30:01] Node.js: ✓ 22.12.0
[2026-03-05 14:30:02] Sealos auth: ✓ (region: <REGION from config.json>)
[2026-03-05 14:30:02] Project: /Users/dev/myapp (github: https://github.com/owner/repo)
[2026-03-05 14:30:03] === Phase 1: Assess ===
[2026-03-05 14:30:03] Score: 9/12 (good)
[2026-03-05 14:30:03] Language: python, Framework: fastapi, Port: 8000
[2026-03-05 14:30:03] Decision: CONTINUE
[2026-03-05 14:30:04] === Phase 2: Detect Image ===
[2026-03-05 14:30:05] Docker Hub: owner/repo:latest (arm64 only, no amd64)
[2026-03-05 14:30:05] GHCR: not found
[2026-03-05 14:30:05] Decision: no amd64 image → continue to Phase 3
[2026-03-05 14:30:06] === Phase 3: Dockerfile ===
[2026-03-05 14:30:06] Existing Dockerfile: none
[2026-03-05 14:30:07] Generated: python-fastapi template, port 8000
[2026-03-05 14:30:08] === Phase 4: Build & Push ===
[2026-03-05 14:30:08] Registry: ghcr (auto-detected via gh CLI)
[2026-03-05 14:30:30] Build: ✓ ghcr.io/zhujingyang/repo:20260305-143022
[2026-03-05 14:30:30] IMAGE_REF=ghcr.io/zhujingyang/repo:20260305-143022
[2026-03-05 14:30:31] === Phase 5: Template ===
[2026-03-05 14:30:32] Output: .sealos/template/index.yaml
[2026-03-05 14:30:33] === Phase 6: Deploy ===
[2026-03-05 14:30:33] Deploy URL: https://template.<REGION_DOMAIN>/api/v2alpha/templates/raw
[2026-03-05 14:30:35] Status: 201 — deployed successfully
[2026-03-05 14:30:35] === DONE ===出现错误时,在停止执行前记录错误详情:
[2026-03-05 14:30:10] === ERROR ===
[2026-03-05 14:30:10] Phase: 4 (Build & Push)
[2026-03-05 14:30:10] Error: docker buildx build failed — "npm ERR! Missing script: build"
[2026-03-05 14:30:10] Retry: 1/3执行结束时,告知用户日志文件存储位置:
Log saved to: ~/.sealos/logs/deploy-20260305-143001.logScripts
脚本说明
Located in within this skill directory ():
scripts/<SKILL_DIR>/scripts/| Script | Usage | Purpose |
|---|---|---|
| | Deterministic readiness scoring (0-12) |
| | Validate |
| | Detect existing Docker/GHCR images |
| | Build amd64 image & push (GHCR preferred, Docker Hub fallback) |
| | Sealos Cloud authentication & workspace switching |
All scripts output JSON. Run via Bash and parse the result.
脚本存放在本工具目录下的文件夹中():
scripts/<SKILL_DIR>/scripts/| 脚本 | 使用方法 | 用途 |
|---|---|---|
| | 确定性就绪度评分(0-12分) |
| | 根据强制规范校验 |
| | 检测已有的Docker/GHCR镜像 |
| | 构建amd64架构镜像并推送(优先使用GHCR,Docker Hub为备选) |
| | Sealos Cloud身份认证与工作区切换 |
所有脚本均输出JSON格式内容,通过Bash运行并解析结果即可。
Internal Skill Dependencies
内部工具依赖
This skill references knowledge files from co-installed internal skills. These are not user-facing — they are loaded on-demand during specific phases.
<SKILL_DIR>SKILL.md<SKILL_DIR>/../<SKILL_DIR>/../
├── sealos-deploy/ ← this skill (user entry point) = <SKILL_DIR>
├── dockerfile-skill/ ← Phase 3: Dockerfile generation knowledge
├── cloud-native-readiness/ ← Phase 1: assessment criteria
└── docker-to-sealos/ ← Phase 5: Sealos template rulesPaths used in pipeline.md follow the pattern:
<SKILL_DIR>/../dockerfile-skill/knowledge/error-patterns.md
<SKILL_DIR>/../dockerfile-skill/templates/<lang>.dockerfile
<SKILL_DIR>/../docker-to-sealos/references/sealos-specs.md本工具引用了同安装的内部工具的知识文件,这些文件不对用户开放,会在特定阶段按需加载。
<SKILL_DIR>SKILL.md<SKILL_DIR>/../<SKILL_DIR>/../
├── sealos-deploy/ ← 本工具(用户入口) = <SKILL_DIR>
├── dockerfile-skill/ ← 第3阶段:Dockerfile生成知识库
├── cloud-native-readiness/ ← 第1阶段:评估标准
└── docker-to-sealos/ ← 第5阶段:Sealos模板规则pipeline.md中使用的路径遵循如下格式:
<SKILL_DIR>/../dockerfile-skill/knowledge/error-patterns.md
<SKILL_DIR>/../dockerfile-skill/templates/<lang>.dockerfile
<SKILL_DIR>/../docker-to-sealos/references/sealos-specs.mdPhase Overview
阶段概览
| Phase | Action | Skip When |
|---|---|---|
| 0 — Preflight | Capability scan, path-specific warnings, Sealos auth | Initial blockers resolved |
| 1 — Assess | Clone repo (or use current project), analyze deployability | Score too low → stop |
| 2 — Detect | Find existing image (Docker Hub / GHCR / README) | Found → jump to Phase 5 |
| 3 — Dockerfile | Generate Dockerfile if missing | Already has one → skip |
| 4 — Build & Push | | — |
| 5 — Template | Generate Sealos application template | — |
| 5.5 — Configure | Guide user through app env vars and inputs | No inputs needed |
| 6 — Deploy | Deploy template to Sealos Cloud | — |
| 阶段 | 操作 | 跳过条件 |
|---|---|---|
| 0 — 前置检查 | 能力扫描、路径专属警告、Sealos身份认证 | 初始阻塞问题已解决 |
| 1 — 项目评估 | 克隆仓库(或使用当前项目)、分析可部署性 | 评分过低 → 终止流程 |
| 2 — 镜像检测 | 查找已有镜像(Docker Hub / GHCR / README) | 找到符合要求的镜像 → 跳至第5阶段 |
| 3 — Dockerfile处理 | 若缺少Dockerfile则自动生成 | 已有Dockerfile → 跳过 |
| 4 — 构建与推送 | | — |
| 5 — 模板生成 | 生成Sealos应用模板 | — |
| 5.5 — 配置引导 | 引导用户设置应用环境变量和输入参数 | 无需输入参数 |
| 6 — 部署执行 | 将模板部署到Sealos Cloud | — |
Decision Flow
决策流程
Input (GitHub URL / local path)
│
▼
[Phase 0] Preflight ── fail → guide user to fix and STOP
│ pass
▼
[Phase 1] Assess ── not suitable → STOP with reason
│ suitable
▼
[Phase 2] Detect existing image
│
├── found (amd64) ────────────────────┐
│ │
▼ │
[Phase 3] Dockerfile (generate/reuse) │
│ │
▼ │
[Phase 4] Build & Push to registry │
│ │
◄─────────────────────────────────────┘
│
▼
[Phase 5] Generate Sealos Template
│
▼
[Phase 5.5] Configure ── present env vars → ask user for inputs → confirm
│
▼
[Phase 6] Deploy to Sealos Cloud ── 401 → re-auth
│ 409 → instance exists
▼
Done — app deployed ✓Execution rule: Phase 1 must never start while Phase 0 still has unresolved entry blockers. Docker, , builder, and registry failures must be reported early, but only become hard blockers if the run later requires local build/push.
gh输入(GitHub链接 / 本地路径)
│
▼
[第0阶段] 前置检查 ── 失败 → 引导用户修复后终止流程
│ 校验通过
▼
[第1阶段] 项目评估 ── 不适合部署 → 告知原因后终止流程
│ 适合部署
▼
[第2阶段] 检测已有镜像
│
├── 找到符合要求的amd64镜像 ────────────────────┐
│ │
▼ │
[第3阶段] Dockerfile处理(生成/复用) │
│ │
▼ │
[第4阶段] 构建镜像并推送到镜像仓库 │
│ │
◄─────────────────────────────────────┘
│
▼
[第5阶段] 生成Sealos模板
│
▼
[第5.5阶段] 配置引导 ── 存在环境变量 → 询问用户输入 → 确认
│
▼
[第6阶段] 部署到Sealos Cloud ── 401错误 → 重新认证
│ 409错误 → 实例已存在
▼
完成 — 应用部署成功 ✓执行规则: 第0阶段仍有未解决的入口阻塞问题时,绝对不能启动第1阶段。Docker、、构建器、镜像仓库相关的故障需要尽早上报,但只有当运行流程后续需要本地构建/推送时,这些故障才会成为强制阻塞项。
gh