diff --git a/pkg/commands/copy.go b/pkg/commands/copy.go index 165d90ee5..d19d04f8b 100644 --- a/pkg/commands/copy.go +++ b/pkg/commands/copy.go @@ -59,12 +59,15 @@ func (c *CopyCommand) ExecuteCommand(config *v1.Config, buildArgs *dockerfile.Bu if err != nil { return err } + if fi.IsDir() && !strings.HasSuffix(fullPath, string(os.PathSeparator)) { + fullPath += "/" + } cwd := config.WorkingDir if cwd == "" { cwd = constants.RootDir } - destPath, err := util.DestinationFilepath(src, dest, cwd) + destPath, err := util.DestinationFilepath(fullPath, dest, cwd) if err != nil { return err }