build: replace uses of archive.CanonicalTarNameForPath

This function is an alias for filepath.IsAbs and we are considering deprecating
and/or removing this function in the archive package, so removing its uses
helps transitioning if we decide to deprecate and/or remove it.

[docker/cli@fb0788f] also added a normalize step in TrimBuildFilesFromExcludes,
so that callers are not _required_ to first normalize the path, so the
normalizeation may be redunant, but keeping the normalization as this variable
is used further down the code.

[docker/cli@fb0788f]: fb0788f18f

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2024-06-16 15:11:10 +02:00 committed by Guillaume Lours
parent 1a14fcb1e6
commit 5ec37d08a5
1 changed files with 1 additions and 1 deletions

View File

@ -124,7 +124,7 @@ func (s *composeService) doBuildClassic(ctx context.Context, project *types.Proj
}
// And canonicalize dockerfile name to a platform-independent one
relDockerfile = archive.CanonicalTarNameForPath(relDockerfile)
relDockerfile = filepath.ToSlash(relDockerfile)
excludes = build.TrimBuildFilesFromExcludes(excludes, relDockerfile, false)
buildCtx, err = archive.TarWithOptions(contextDir, &archive.TarOptions{