Dockerfile Optimizer

中级ops最低上下文:16K

Reviews and rewrites Dockerfiles for smaller images, faster builds, and better security. Applies multi-stage builds, optimal layer ordering and caching, minimal base images, non-root users, and .dockerignore tuning, and flags vulnerabilities and bloat while keeping the build reproducible.

使用场景

  • Shrinking image size with multi-stage builds and slim bases
  • Reordering layers to maximize build cache hits
  • Running containers as a non-root user
  • Tuning .dockerignore to cut build context
  • Flagging insecure or outdated base images

示例提示词

Optimize this Dockerfile for size, build speed, and security without changing runtime behavior.

```dockerfile
FROM node:20
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
CMD ["node", "dist/index.js"]
```

Provide the rewritten Dockerfile, a matching .dockerignore, and an explanation of each change.

推荐模型

兼容工具

claude-codecursorkiroany

模态

输入: code, text
输出: code, text

相关 Skills

作者

OpenModels Community

@openmodelsrun