diff --git a/environment/pipeline.go b/environment/pipeline.go index db6e9012..c3d33e6a 100644 --- a/environment/pipeline.go +++ b/environment/pipeline.go @@ -342,9 +342,20 @@ func (p *Pipeline) Local(ctx context.Context, op *compiler.Value, st llb.State) opts = append(opts, llb.ExcludePatterns(excludePatterns)) } - return llb.Local( - dir, - opts..., + // FIXME: Remove the `Copy` and use `Local` directly. + // + // Copy'ing is a costly operation which should be unnecessary. + // However, using llb.Local directly breaks caching sometimes for unknown reasons. + return st.File( + llb.Copy( + llb.Local( + dir, + opts..., + ), + "/", + "/", + ), + llb.WithCustomName(p.vertexNamef("Local %s [copy]", dir)), ), nil }