/polymath-devops:audit-dockerfilefrom polymath-devops
Audit a Dockerfile for base-image hygiene, layer order, multi-stage discipline, secret leakage, and missing healthcheck/USER directives.
Ships in polymath-devops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Find footguns in a Dockerfile before they ship. Output is a categorized review with concrete diffs.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
.dockerignore (optional — its absence is a finding).HEALTHCHECK matters.hadolint is available (hadolint Dockerfile, or docker run --rm -i hadolint/hadolint < Dockerfile), run it first and fold its rule IDs into the findings below; never mark a line clean that it flags without saying why the rule doesn't apply.FROM image@sha256:… for production builds. Tag-pinned (alpine:3.19) floats on each rebuild.:latest. Refuse to approve.COPY package.json package-lock.json ./
RUN npm ci
COPY . .
Reversing this invalidates the npm ci cache on every source edit.USER non-root (numeric UID or named). Running as root is a common scanner finding.HEALTHCHECK and uses probes). Use a binary already in the image — exec form, e.g. HEALTHCHECK CMD ["/app/healthcheck"] or the app's own --health flag. Don't install curl just for this; distroless/slim runtimes don't have it, and it widens the attack surface.ENV SECRET=… for build-time secrets. Use --secret mount (BuildKit).COPY .env . ever.ARG values appear in image history — never sensitive.COPY discipline.
COPY src/ ./src/ over COPY . . (avoids accidental node_modules / .git inclusion)..dockerignore should exist and exclude .git, node_modules, build artifacts, OS junk.RUN cleanup. Single RUN with && apt-get clean && rm -rf /var/lib/apt/lists/* style. Multiple RUN install lines leave layers full of cached package metadata.ENTRYPOINT vs CMD. ENTRYPOINT for the binary; CMD for default args. JSON-form (["bin", "arg"]) over shell-form to avoid signal-handling surprises.audit-dockerfile
File: Dockerfile (multi-stage, 2 stages)
Issues
- FROM node:20 (tag-pinned, floats)
Fix: FROM node:20@sha256:<digest>
- Final stage runs as root.
Fix: add `USER node` (or numeric UID 1000) before CMD.
- COPY . . (line 18) pulls in .git + node_modules.
Fix: COPY src/ ./src/ + COPY package.json ./ + .dockerignore.
- No HEALTHCHECK directive (image runs under Docker Compose, not k8s).
Fix: HEALTHCHECK CMD ["node", "healthcheck.js"] (node is already in the image)
- Three separate RUN apt-get install lines.
Fix: combine into one RUN with apt-get clean tail.
Recommendation: 5 fixes; image size reduction estimated ~120MB.
.dockerignore reviewed alongside.FROM ubuntu:latest. Floats.ADD https://… to fetch remote files. Cache-unfriendly + verifies poorly.RUN curl … | bash. Pipe-to-shell from a Dockerfile is supply-chain risk.USER root in the final stage with a comment "we'll fix later". Don't ship.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mohammadbafkar/polymath --plugin polymath-devops5 skills in this plugin
/audit-composeAudit docker-compose.yaml — image pinning, named volumes, networks, secret injection, depends_on health-conditioning./ci-pipeline-githubAuthor a GitHub Actions workflow — lint/test/build/deploy with caching, concurrency control, OIDC for cloud auth, minimal permissions./dockerizeWrite a multi-stage Dockerfile — distroless or minimal base, build/runtime split, deterministic layer order, non-root user, no secrets baked in.Other plugins' skills for the same job