зеркало из https://github.com/microsoft/docker.git
abort on error and fix debug
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
Родитель
42ca8a064b
Коммит
0098360726
|
@ -167,8 +167,9 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
||||||
options := &archive.TarOptions{
|
options := &archive.TarOptions{
|
||||||
Compression: archive.Uncompressed,
|
Compression: archive.Uncompressed,
|
||||||
}
|
}
|
||||||
ignoreFile := path.Join(root, ".dockerignore")
|
if ignore, err := ioutil.ReadFile(path.Join(root, ".dockerignore")); err != nil && !os.IsNotExist(err) {
|
||||||
if ignore, err := ioutil.ReadFile(ignoreFile); err == nil {
|
return fmt.Errorf("Error reading .dockerignore: '%s'", err)
|
||||||
|
} else if err == nil {
|
||||||
for _, pattern := range strings.Split(string(ignore), "\n") {
|
for _, pattern := range strings.Split(string(ignore), "\n") {
|
||||||
ok, err := filepath.Match(pattern, "Dockerfile")
|
ok, err := filepath.Match(pattern, "Dockerfile")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -343,11 +343,11 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
||||||
for _, exclude := range options.Excludes {
|
for _, exclude := range options.Excludes {
|
||||||
matched, err := filepath.Match(exclude, relFilePath)
|
matched, err := filepath.Match(exclude, relFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Errorf("Error matching: %s (pattern: %s)\n", relFilePath, exclude)
|
utils.Errorf("Error matching: %s (pattern: %s)", relFilePath, exclude)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if matched {
|
if matched {
|
||||||
utils.Debugf("Skipping excluded path: %s\n", relFilePath)
|
utils.Debugf("Skipping excluded path: %s", relFilePath)
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче