diff --git a/frontend/dockerfile/dockerfile2llb/convert.go b/frontend/dockerfile/dockerfile2llb/convert.go index ea5e8601536ba..e11da2eb69ebc 100644 --- a/frontend/dockerfile/dockerfile2llb/convert.go +++ b/frontend/dockerfile/dockerfile2llb/convert.go @@ -1139,7 +1139,10 @@ func dispatchCopy(d *dispatchState, cfg copyConfig) error { } if cfg.params.DestPath == "." || cfg.params.DestPath == "" || cfg.params.DestPath[len(cfg.params.DestPath)-1] == filepath.Separator { - dest += string(filepath.Separator) + // can use unix path separator since + // at this point, Windows dest path is already normalized + // in `pathRelativeToWorkingDir` above. + dest += "/" } var copyOpt []llb.CopyOption diff --git a/solver/llbsolver/file/backend.go b/solver/llbsolver/file/backend.go index 293caa1082bd9..58b489cb8a286 100644 --- a/solver/llbsolver/file/backend.go +++ b/solver/llbsolver/file/backend.go @@ -139,7 +139,7 @@ func docopy(ctx context.Context, src, dest string, action pb.FileActionCopy, u * } destPath, err := cleanPath(action.Dest) if err != nil { - return errors.Wrap(err, "cleaning path") + return errors.Wrap(err, "cleaning destination path") } if !action.CreateDestPath { p, err := fs.RootPath(dest, filepath.Join("/", action.Dest))