MCPInstall

docker-build-deploy

Use when containerizing a Node.js app and setting up GitHub Actions CI/CD to build, push to GHCR, and deploy via SSH. Multi-stage build, non-root user, caching.

Installs
1K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/wu529778790/shenzjd-skills --skill docker-build-deploy
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads docker-build-deploy automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Docker Build & Deploy

一键生成 Docker 构建 + 推送到 GHCR + 部署到服务器的 GitHub Actions 工作流。

Overview

自动生成完整的 Docker CI/CD 工作流:构建镜像 → 推送到 GHCR → SSH 部署到服务器。包含优化的 Dockerfile(多阶段构建、非 root、健康检查)和 GitHub Actions 工作流模板。

When to Use

  • User wants to containerize a project and deploy it
  • User needs GitHub Actions to automatically build Docker images
  • User mentions Docker, GHCR, container deployment, or CI/CD
  • User inputs /docker-build-deploy
  • User wants to set up continuous deployment pipeline
  • User wants to push images to a container registry
  • User wants to automate deployment to a remote server via SSH
  • User wants to optimize existing Dockerfile with multi-stage builds
  • User wants to add health checks to container deployment

When NOT to Use:

  • User only wants to write a Dockerfile
  • User deploys with Kubernetes (different workflow - consider kubectl or Helm)
  • User doesn't use GitHub Actions (consider GitLab CI, CircleCI, etc.)
  • User wants to deploy to AWS ECS/EKS, Google Cloud Run, or Azure Container Instances (different workflows)

Core Pattern

Step 1: 收集信息

交互式询问:port(容器内端口,默认 3000)、host_port(对外暴露端口,默认同 port)、env_file(服务器 env 路径,可选)。

智能检测:有 package.json → Node.js(当前唯一支持的项目类型)。已有 Dockerfile 则跳过生成。

Step 2: 生成 Dockerfile(如需要)

生成优化的 Node.js Dockerfile:多阶段构建、非 root 用户、健康检查。模板见 templates/Dockerfile.nodejs。

Step 3: 生成 Workflow

从 templates/docker-deploy.yml 生成工作流,替换 {{PORT}}(容器端口)、{{HOST_PORT}}(对外端口)和 {{ENV_FILE}} 变量。

build-and-push job: 登录 GHCR → Buildx 构建 → 推送(tag: latest + sha)→ GHA 缓存

deploy job: SSH 连接 → 拉取镜像 → 停旧容器 → 启新容器(支持 env 文件)→ 清理旧镜像

Step 4: 提示配置 Secrets

告知用户需在 GitHub Settings → Secrets 配置:DEPLOY_HOST、DEPLOY_USER、DEPLOY_SSH_KEY(服务器私钥)。

安全性:使用 SSH key 而非密码(密码登录有爆破风险,且明文存于 CI)。若服务器只支持密码,可改用 password: ${{ secrets.DEPLOY_PASSWORD }},但不推荐。

Quick Reference

/docker-build-deploy
/docker-build-deploy --port 8080
/docker-build-deploy --port 8080 --env-file /opt/app/.env
参数说明默认值
--port容器内应用端口3000
--host-port服务器对外暴露端口同 --port
--env-file服务器 env 文件路径空

Common Mistakes

错误正确做法原因
用 latest 单 tag同时打 latest + ${{ github.sha }}方便回滚
不设置 packages: write 权限声明 permissions: packages: writeGHCR 推送需要
deploy 不检查容器是否存在先 docker stop + docker rm避免端口冲突
不清理旧镜像部署后 docker image prune -f磁盘空间
Dockerfile 用 root 运行添加 USER node 或非 root 用户容器安全最佳实践
Secrets 硬编码在 workflow 中使用 ${{ secrets.XXX }} 引用密钥泄露风险
不设置 Docker BuildKit 缓存配置 cache-from / cache-to using GitHub Actions cache每次全量构建太慢
不处理构建失败的回滚部署后验证健康检查失败部署可能上线错误版本
用密码 SSH 部署使用 SSH key(DEPLOY_SSH_KEY)密码爆破风险高
平台声明与服务器架构不符按服务器架构声明 linux/amd64 或 linux/arm64;多平台构建时写 linux/amd64,linux/arm64目标架构不匹配导致运行失败

FAQ

What does the docker-build-deploy skill do?

Use when containerizing a Node.js app and setting up GitHub Actions CI/CD to build, push to GHCR, and deploy via SSH. Multi-stage build, non-root user, caching.

How do I install docker-build-deploy?

Run npx skills add https://github.com/wu529778790/shenzjd-skills --skill docker-build-deploy in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/docker-build-deploy/ (personal) or .claude/skills/docker-build-deploy/ (project).

Which AI agents can use docker-build-deploy?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is docker-build-deploy safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains docker-build-deploy?

It is published by wu529778790 in wu529778790/shenzjd-skills. It has 1,033 recorded installs.

More from wu529778790/shenzjd-skills

View all →

dependency-audit

wu529778790/shenzjd-skills

Use when auditing project dependencies for security vulnerabilities, outdated packages, or license compliance across npm/yarn/pnpm, pip, go, and cargo.

Security989 installs

git-hooks-setup

wu529778790/shenzjd-skills

Use when setting up git hooks (pre-commit, commit-msg, pre-push) with husky or native hooks for linting, formatting, commit conventions, and secret scanning.

db-migration-helper

wu529778790/shenzjd-skills

Use when generating database migration SQL from model or schema changes — compares current vs desired schema, detects diffs, outputs reversible safe migrations.

github-profile-beautifier

wu529778790/shenzjd-skills

Use when creating or improving a GitHub profile README — themed stats cards, project showcase, tech-stack badges, and typing banner. 5 themes, smart project ranking (snake contribution graph needs separate setup).

Docs & Writing570 installs

api-doc-generator

wu529778790/shenzjd-skills

Use when generating OpenAPI/Swagger API docs from existing code — scans routes/annotations, extracts params and responses, outputs a YAML/JSON spec.

Backend & APIs550 installs

performance-profiler

wu529778790/shenzjd-skills

Use when profiling a Node/Go/Python project for performance bottlenecks — bundle size, dependency bloat, large files, unused code — and outputting prioritized optimization recommendations.

Popular devops & cloud skills

View category →

microsoft-foundry

microsoft/azure-skills

Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure

OfficialDevOps & Cloud579.1K installs

azure-diagnostics

microsoft/azure-skills

Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.

OfficialDevOps & Cloud569.8K installs

azure-prepare

microsoft/azure-skills

Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.

OfficialDevOps & Cloud569K installs

azure-ai

microsoft/azure-skills

Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.

OfficialDevOps & Cloud568.8K installs

azure-deploy

microsoft/azure-skills

Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.

OfficialDevOps & Cloud568.6K installs

azure-validate

microsoft/azure-skills

Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.

OfficialDevOps & Cloud568K installs