I'm trying to use the new RUN --mount option in docker's experimental feature set but am having difficulty getting it to do what I want which is...
project folder listing
hello.cpp
makefile
Dockerfile
And the Dockerfile looks like:
#syntax=docker/dockerfile:experimental
FROM ubuntu
RUN --mount=type=cache,target=/home,source=. make
CMD ["bash"]
and the build command looks like:
docker build -t myimage:latest .
basically, I want to preserve the advantage that make only compiles out of date targets which rules out using COPY . /home because this appears not too preserve the timestamps on the files copied across. make always makes everything.
N.B. I've simplified the --mount options to the minimal set, IRL I'd add uid=1000,gid=1000 or similar.
The error messages I get vary with how I set the options. Either docker build barfs with a 'directory not found' message, or make fails with 'no makefile found`.
I'm pretty sure I just don't know how to set the source and target values correctly, and am not finding the documentation helpful.
Thanks!