From fb4d1f9c8d61c3ca4bea287533f1612d9259c9b4 Mon Sep 17 00:00:00 2001 From: ohchang-kwon Date: Fri, 3 Jan 2020 19:21:29 +0900 Subject: [PATCH] add handling when source directory does not have slash suffix --- pkg/commands/copy.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 }