mirror of https://github.com/docker/cli.git
build: replace uses of archive.CanonicalTarNameForPath
As it's just an alias for filepath.IsAbs. Also added a normalize step in TrimBuildFilesFromExcludes, so that callers are not _required_ to first normalize the path. We are considering deprecating and/or removing this function in the archive package, so removing it in the cli code helps transitioning if we decide to deprecate and/or remove it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
6205b4eae6
commit
fb0788f18f
|
@ -265,7 +265,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
|
|||
}
|
||||
|
||||
// And canonicalize dockerfile name to a platform-independent one
|
||||
relDockerfile = archive.CanonicalTarNameForPath(relDockerfile)
|
||||
relDockerfile = filepath.ToSlash(relDockerfile)
|
||||
|
||||
excludes = build.TrimBuildFilesFromExcludes(excludes, relDockerfile, options.dockerfileFromStdin())
|
||||
buildCtx, err = archive.TarWithOptions(contextDir, &archive.TarOptions{
|
||||
|
|
|
@ -32,6 +32,9 @@ func TrimBuildFilesFromExcludes(excludes []string, dockerfile string, dockerfile
|
|||
if keep, _ := fileutils.Matches(".dockerignore", excludes); keep {
|
||||
excludes = append(excludes, "!.dockerignore")
|
||||
}
|
||||
|
||||
// canonicalize dockerfile name to be platform-independent.
|
||||
dockerfile = filepath.ToSlash(dockerfile)
|
||||
if keep, _ := fileutils.Matches(dockerfile, excludes); keep && !dockerfileFromStdin {
|
||||
excludes = append(excludes, "!"+dockerfile)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue