resolve symlinks while making dockerfile path absolute

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2025-05-28 11:43:25 +02:00 committed by Guillaume Lours
parent cf89fd1aa1
commit 45bd60c33a

View File

@ -420,8 +420,15 @@ func dockerFilePath(ctxName string, dockerfile string) string {
if dockerfile == "" {
return ""
}
if urlutil.IsGitURL(ctxName) || filepath.IsAbs(dockerfile) {
if urlutil.IsGitURL(ctxName) {
return dockerfile
}
return filepath.Join(ctxName, dockerfile)
if !filepath.IsAbs(dockerfile) {
dockerfile = filepath.Join(ctxName, dockerfile)
}
symlinks, err := filepath.EvalSymlinks(dockerfile)
if err == nil {
return symlinks
}
return dockerfile
}