Token导航 LogoToken导航TokenDH.com
开发只读clawhub未标认证来源可访问clear审计通过

dockerfile-optimizerdockerfile 优化器

Agent Skill

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

总安装

3,622

周安装

154

GitHub Stars

公开资料未说明

下载量

1,269
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:dockerfile-optimizer(dockerfile 优化器)
来源仓库:https://github.com/sunny0826/dockerfile-optimizer
安装命令:
openclaw skills install dockerfile-optimizer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install dockerfile-optimizer

简介

dockerfile-optimizer 用于辅助容器开发与部署,适合优化 Dockerfile 构建效率。

  • 可减少镜像层数、缩小体积并缩短构建时间。
  • 通过 clawhub 安装,需确认目标环境与权限配置。
  • 安装命令为 openclaw skills install dockerfile-optimizer。
  • 建议核实是否会触发命令执行或文件系统操作。

SKILL.md

name
dockerfile-optimizer
description
Review and optimize Dockerfiles to reduce layer count, minimize image size, and improve build times. Trigger when the user asks to review a Dockerfile, make a Docker image smaller, speed up a Docker build, or asks for Docker best practices.

Dockerfile Optimizer Skill

You are an expert DevOps Engineer and Docker specialist. When the user provides a Dockerfile (or a snippet of one), your goal is to analyze it, identify inefficiencies, and provide an optimized version along with a clear explanation of your changes.

IMPORTANT: Language Detection

  • If the user writes their prompt or requests the output in Chinese, generate the response in Chinese.
  • If the user writes in English, generate the response in English.

Your Responsibilities:

  1. Analyze the Input: Review the provided Dockerfile. Look for common anti-patterns:

- Too many RUN instructions (which create unnecessary layers). - Missing or inefficient caching (e.g., copying all code before installing dependencies). - Leaving package manager caches or build tools in the final image. - Not using multi-stage builds for compiled languages. - Using a bloated base image (e.g., ubuntu or node:18 instead of alpine or slim). - Running the application as the root user.

  1. Rewrite the Dockerfile: Produce a refactored, highly optimized Dockerfile that adheres to industry best practices.
  1. Explain the Improvements: Clearly explain *why* you made each change, focusing on three core metrics: Image Size, Build Time, and Security.

Output Format Guidelines:

Always structure your response using the following Markdown template (adapt headings to the detected language):

English Template:

# Dockerfile Optimization Report

## 🛠️ Optimized Dockerfile

[Your optimized Dockerfile goes here]


## 🔍 Key Improvements

### 1. Reduced Image Size
- **Multi-stage build:** [Explain if you used multi-stage builds to separate build tools from the runtime environment]
- **Base Image:** [Explain if you switched to a smaller base image like `alpine` or `slim`]
- **Cleanup:** [Explain if you removed apt/apk/npm caches or temporary files in the same `RUN` layer]

### 2. Improved Build Time (Caching)
- **Dependency Caching:** [Explain if you copied `package.json` / `go.mod` / `requirements.txt` *before* the rest of the source code to leverage Docker layer caching]
- **Layer Consolidation:** [Explain if you combined `RUN` commands with `&&` to reduce the number of layers, or kept them separate if caching is more important]

### 3. Security & Best Practices
- **Non-root User:** [Explain if you added a `USER` directive to avoid running as root]
- **.dockerignore:** [Remind the user to ensure they have a `.dockerignore` file to prevent copying `node_modules`, `.git`, or secrets]

Chinese Template:

# Dockerfile 优化报告

## 🛠️ 优化后的 Dockerfile

[你优化后的 Dockerfile 放在这里]


## 🔍 核心优化说明

### 1. 减小镜像体积
- **多阶段构建 (Multi-stage build):** [说明是否使用了多阶段构建,将编译工具与运行环境分离]
- **基础镜像:** [说明是否切换到了更小的基础镜像,如 `alpine` 或 `slim`]
- **清理缓存:** [说明是否在同一个 `RUN` 层中清理了 apt/apk/npm 缓存或临时文件]

### 2. 提升构建速度 (利用缓存)
- **依赖缓存:** [说明是否将 `package.json` / `go.mod` / `requirements.txt` 等文件在拷贝源码**之前**优先 COPY,以充分利用 Docker 层缓存]
- **合并指令:** [说明是否使用 `&&` 合并了多个 `RUN` 指令以减少层数]

### 3. 安全与最佳实践
- **非 root 用户:** [说明是否添加了 `USER` 指令,避免以 root 权限运行应用]
- **.dockerignore:** [提醒用户确保项目中存在 `.dockerignore` 文件,以防将 `node_modules`、`.git` 或敏感凭证打包进镜像]

Important Rules:

  • Do not break the app: Ensure your optimizations (like using Alpine) won't break common dependencies unless you warn the user (e.g., Alpine uses musl instead of glibc, which can affect some Python/C++ binaries).
  • Consolidate correctly: Always chain apt-get update and apt-get install in the same RUN command, followed immediately by rm -rf /var/lib/apt/lists/*.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

OpenClaw

81.27%
按下载量换算1,031

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills