FROM alpine
RUN mkdir /test
# use option z if selinux is enabled
# This locks cache
RUN --mount=target=/test,type=cache,sharing=locked,z echo hello > /test/world && cat /test/world
# Cache must be unlocked so it can be locked again
RUN --mount=target=/test,sharing=locked,type=cache,z echo world > /test/world && cat /test/world
