Browse Source

resolve Dockerfile symlink but file name

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 4 months ago
parent
commit
69f1430a49
1 changed files with 3 additions and 2 deletions
  1. 3 2
      pkg/compose/build_bake.go

+ 3 - 2
pkg/compose/build_bake.go

@@ -436,9 +436,10 @@ func dockerFilePath(ctxName string, dockerfile string) string {
 	if !filepath.IsAbs(dockerfile) {
 		dockerfile = filepath.Join(ctxName, dockerfile)
 	}
-	symlinks, err := filepath.EvalSymlinks(dockerfile)
+	dir := filepath.Dir(dockerfile)
+	symlinks, err := filepath.EvalSymlinks(dir)
 	if err == nil {
-		return symlinks
+		return filepath.Join(symlinks, filepath.Base(dockerfile))
 	}
 	return dockerfile
 }