mirror of
https://github.com/moby/moby.git
synced 2025-12-12 10:01:33 +03:00
Merge pull request #8739 from duglin/CleanupDockerIgnores
Do some cleanup on .dockerignore paths
This commit is contained in:
@@ -144,6 +144,11 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
||||
return fmt.Errorf("Error reading .dockerignore: '%s'", err)
|
||||
}
|
||||
for _, pattern := range strings.Split(string(ignore), "\n") {
|
||||
pattern = strings.TrimSpace(pattern)
|
||||
if pattern == "" {
|
||||
continue
|
||||
}
|
||||
pattern = filepath.Clean(pattern)
|
||||
ok, err := filepath.Match(pattern, "Dockerfile")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Bad .dockerignore pattern: '%s', error: %s", pattern, err)
|
||||
|
||||
Reference in New Issue
Block a user