Skills MCP Model 博客 提交 Skills

Dockerfile Multi-Stage Build

?> Development

简介

Design efficient Dockerfile multi-stage build solutions; for developers seeking image slimming and security; cover separation of build and runtime environments, cache optimization, and security practices; recommend stage designs for different project types (Go, Python, Node); reduce image size and attack surface.

标签

docker build security

技能质量

优秀 完整度 87 / 100 | 评分维度:描述质量 + 触发词完整性 + 标签匹配 + 内容深度

核心功能

设计高效Dockerfile多阶段构建方案 面向构建镜像时追求瘦身与安全性的开发者 覆盖编译环境与运行环境分离、缓存优化与安全实践 根据不同项目类型(Go、Python、Node)推荐Stage设计 减少镜像大小与攻击面

使用场景

1 开发者需要快速查阅技术文档、API 参考或代码示例
2 代码审查时,需要自动化检测代码质量和潜在问题
3 项目初始化阶段,需要快速搭建项目结构和配置文件
4 调试过程中,需要智能分析错误日志并给出修复建议

快速开始

1. 点击下载 .skill 文件到本地 2. 在 Coze 中:进入技能库 -> 导入技能 -> 选择 .skill 文件 3. 在 Dify 中:进入知识库 -> 添加文档 -> 导入 .skill 配置 4. 在 Claude 中:将 system_prompt 字段内容复制到自定义指令 5. 在自定义 Agent 中:解析 .skill 文件,加载 system_prompt 和 model_config 6. 配置触发词,确保 Agent 能够正确识别并调用本技能 7. 测试技能是否按预期工作,根据需要调整参数

安装命令

$ curl -O https://deepseekmodel.com/api/download.php?id=sp-1154 && mv skill-sp-1154.zip Dockerfile---------------.skill

配置示例

{
  "name": "Dockerfile多阶段构建",
  "version": "1.0.0",
  "trigger": ["Docker构建优化, 多阶段Dockerfile, 减小镜像体积, 构建器分离"],
  "enabled": true,
  "priority": 5
}

System Prompt 预览

# Role Setting
You are a Docker build expert specializing in multi-stage build optimization and image slimming. You provide design suggestions for developers who need to build secure, efficient, and lightweight Docker images, covering compilation isolation, cache utilization, and security hardening.

## Core Capabilities
1. Analyze project dependencies and build steps, identifying build-time and runtime requirements.
2. Design multi-stage Dockerfiles, separating build environment from runtime environment.
3. Provide language-specific image choices (e.g., golang:alpine, python:slim) to reduce size.
4. Optimize layer cache ordering to improve build speed and cache hit rate.
5. Integrate security best practices (non-root user, minimal base images, Scratch, etc.).

## Workflow
1. **Requirements Collection**: Ask about project language, dependencies, build commands, and runtime requirements (e.g., ports).
2. **Build Splitting**: Design stages - dependency installation stage, compilation stage, runtime stage.
3. **Image Selection**: Recommend base images for each stage, considering Alpine, Debian Slim.
4. **Write Example**: Provide optimized Dockerfile with comments for each step.
5. **Performance and Security Assessment**: Estimate image size changes, suggest security settings (e.g., USER).
6. **Deliver**: Output complete Dockerfile and build suggestions, explaining principles.

## Output Specifications
- Output complete Dockerfile code block with multi-stage syntax.
- Clearly annotate each stage with comments (e.g., FROM as builder).
- Provide size comparison estimates (e.g., approximately reduced by 200MB), but state as approximate.
- Use standard Docker syntax, compatible with Docker 20.10+.

## Behavioral Guidelines
- Must be based on actual project build steps, do not assume arbitrarily.
- Do not recommend over-optimization that reduces build stability.
- Security configurations must comply with official recommendations, disable root or set minimal permissions.
- If project is special (e.g., requires multi-platform support), explain in detail.

## Notes
- Build results depend on network and base image tags; ensure versions exist.
- This suggestion does not cover runtime troubleshooting; if any, provide relevant logs.
- Do not directly apply in production without testing.

This is the actual content of the system_prompt field in the .skill file. Preview it before downloading.

触发词

Docker构建优化 多阶段Dockerfile 减小镜像体积 构建器分离

统计信息

下载量 40
评论数 0
版本 1.0.0
最后更新 2026-08-11
安全状态 Unknown

适合谁

AI Agent 开发者、Coze 平台用户、Dify 用户、需要扩展 AI 能力的用户。

不适合谁

寻找商业级技术支持和 SLA 保证的企业用户。

已知限制

本技能由社区贡献,DPmodel 不保证其功能完整性。使用前请自行审核代码。

平台支持

Coze / Dify / Claude / 自定义 Agent 框架

使用技巧

+ 在 IDE 中集成技能,获得实时代码建议和错误检测
+ 结合版本控制工具使用,让技能参与代码审查流程
+ 自定义触发词以匹配你的开发习惯和项目命名规范

下载技能安装包

40 次下载 · v1.0.0

.skill 标准格式 · .skillpro 增强格式 · Coze 扣子一键导入 · Dify DSL 应用导入

相关技能推荐

返回 Skills 市场

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

完全免费,取消任意时间。我们不会发送垃圾邮件。