Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How is docker run cache handled across rebuilds #482

Closed
nmiculinic opened this issue Oct 14, 2021 · 4 comments
Closed

Question: How is docker run cache handled across rebuilds #482

nmiculinic opened this issue Oct 14, 2021 · 4 comments

Comments

@nmiculinic
Copy link

For example I have the following lines in the dockerfile:

RUN --mount=type=cache,target=/go/pkg/mod go mod download
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg/mod CGO_ENABLED=0 go build -ldflags "${LDFLAGS}" -o app ./cmd/controlplane

How are those cache lines handled across rebuilds? I'm missing details in the documentation to understand what's happening.

@crazy-max
Copy link
Member

@nmiculinic

How are those cache lines handled across rebuilds?

This type of cache is internal and as the GitHub Runners are ephemeral the BuildKit state volume is lost. But if you have a self-hosted runner it should be reused if you stick to the same builder.

I guess we could handle a specific cache for this volume in the GitHub Action itself with @actions/cache. cc @tonistiigi

@Richard87
Copy link

This would be amazing for my RUN yarn install and RUN composer install lines!

@crazy-max
Copy link
Member

Since docker/buildx#672 BuildKit state is saved in a named volume. We should be able to cache it and mount it back but that would require some changes in the setup-buildx-action. Will think about it.

@crazy-max
Copy link
Member

Tracked in docker/setup-buildx-action#122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants