CI Perf Lint

dockerfile-apk-add-without-no-cache-or-cache-mount

Detects direct apk add commands in shell or JSON-form Dockerfile RUN and ONBUILD RUN instructions that do not use --no-cache or a BuildKit cache/tmpfs mount covering the effective apk cache directory.

This rule looks for:

and reports when the instruction lacks both:

Mount option order and target/dst/destination aliases are supported. Parent directory mounts cover the cache; subdirectories, similarly named paths and secret mounts do not. Tmpfs avoids persisting the cache but does not preserve it across builds.

Options before add, simple wrappers and command-local --no-cache are recognized. A flag on another command, in a comment or inside echoed text does not suppress the finding. Explicit package versions do not disable caching. Simulations, custom roots, unresolved cache paths, heredocs and uncertain shell control flow are excluded. One finding per Dockerfile points to the first affected instruction.

Why it matters:

What to do: