analyze_multistage
Analyzes a Dockerfile to determine if a multi-stage build would reduce image size and attack surface by identifying build tools and dependencies left in the final image.
Instructions
Analyzes a Dockerfile and reports whether it would benefit from a multi-stage build. Detects build-tool commands (npm install/build, mvn, gradle, go build, cargo build, pip install with compilers, dotnet build/publish, make/cmake/gcc) combined with a single-stage FROM, which usually means build tools and dev dependencies end up shipped in the final image unnecessarily — increasing image size and attack surface.
This tool only analyzes and returns reasoning plus the raw Dockerfile content — it does NOT generate the rewritten Dockerfile itself. If it reports multi-stage as recommended, use the returned content and detected build system to draft a multi-stage version yourself: a "builder" stage that runs the build commands, and a slim runtime stage that only COPYs the compiled artifact from the builder stage.
Args: dockerfile_path: full path to an existing Dockerfile on this machine. Accepts either a Windows path ("C:\path\Dockerfile") or a Git Bash style path ("/c/path/Dockerfile").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dockerfile_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |