mirror of https://github.com/docker/compose.git
watch: only monitor configured paths (#10599)
For performance, don't watch the entire build context. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
eafcd1b35e
commit
916aac6c27
|
@ -130,9 +130,7 @@ func (s *composeService) Watch(ctx context.Context, project *types.Project, serv
|
|||
}
|
||||
|
||||
name := service.Name
|
||||
bc := service.Build.Context
|
||||
|
||||
dockerIgnores, err := watch.LoadDockerIgnore(bc)
|
||||
dockerIgnores, err := watch.LoadDockerIgnore(service.Build.Context)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -150,12 +148,17 @@ func (s *composeService) Watch(ctx context.Context, project *types.Project, serv
|
|||
dotGitIgnore,
|
||||
)
|
||||
|
||||
watcher, err := watch.NewWatcher([]string{bc}, ignore)
|
||||
var paths []string
|
||||
for _, trigger := range config.Watch {
|
||||
paths = append(paths, trigger.Path)
|
||||
}
|
||||
|
||||
watcher, err := watch.NewWatcher(paths, ignore)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(s.stdinfo(), "watching %s\n", bc)
|
||||
fmt.Fprintf(s.stdinfo(), "watching %s\n", paths)
|
||||
err = watcher.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue