1
0
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:
Tibor Vass
2014-11-03 16:05:24 -05:00
2 changed files with 36 additions and 1 deletions

View File

@@ -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)