We're using buildkit because it drastically reduces the size of the build context that needs to be copied across during builds. However, it looks like RUN --mount=type=cache causes the entire build context to be copied for some reason.
Before:
COPY something /something
WORKDIR /something/
RUN go build
=> [internal] load build context 0.1s
=> => transferring context: 1.27MB 0.0s
After:
COPY something /something
WORKDIR /something/
RUN --mount=type=cache,target=/.cache go build
=> [internal] load build context 103.3s
=> => transferring context: 5.28GB 103.3s
...
This is on Windows 10 with experimental features enabled in Docker.
We're using buildkit because it drastically reduces the size of the build context that needs to be copied across during builds. However, it looks like
RUN --mount=type=cachecauses the entire build context to be copied for some reason.Before:
After:
This is on Windows 10 with experimental features enabled in Docker.