A cache mount survives a lock file change

A layer cache is invalidated by any change to the file it depends on; a cache mount is storage that outlives the layer entirely.

# syntax=docker/dockerfile:1.4

COPY composer.json composer.lock ./
RUN --mount=type=cache,target=/root/.composer/cache 
    composer install --no-dev --prefer-dist --no-progress

# adding one package now downloads one package rather
# than all 340.

# and the caveat: the cache is per BUILDER, so a fresh CI
# runner has an empty one unless it is exported.

The syntax directive at the top is required and its absence turns the --mount flag into a parse error rather than a silent no-op, which is the good failure. The per-builder scope is what limits its usefulness in CI without a cache export, and it also means the build is no longer reproducible from the Dockerfile alone — a real trade for a real speedup.