Skip to content

Commit

Permalink
Merge pull request moby#4598 from nobiit/patch-2
Browse files Browse the repository at this point in the history
Fix missing chown/chmod when using parents flag with ADD/COPY command
  • Loading branch information
jedevc authored Jan 31, 2024
2 parents cd8a356 + fcbcf1b commit 6b2dfbc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -1219,24 +1219,24 @@ func dispatchCopy(d *dispatchState, cfg copyConfig) error {
return errors.Wrap(err, "removing drive letter")
}

var patterns []string
if cfg.parents {
path := strings.TrimPrefix(src, "/")
patterns = []string{path}
src = "/"
}

opts := append([]llb.CopyOption{&llb.CopyInfo{
Mode: mode,
FollowSymlinks: true,
CopyDirContentsOnly: true,
IncludePatterns: patterns,
AttemptUnpack: cfg.isAddCommand,
CreateDestPath: true,
AllowWildcard: true,
AllowEmptyWildcard: true,
}}, copyOpt...)

if cfg.parents {
path := strings.TrimPrefix(src, "/")
opts = append(opts, &llb.CopyInfo{
IncludePatterns: []string{path},
})
src = "/"
}

if a == nil {
a = llb.Copy(cfg.source, src, dest, opts...)
} else {
Expand Down

0 comments on commit 6b2dfbc

Please sign in to comment.