don't apply "rebuild" watch strategy by default

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2023-06-14 15:21:15 +02:00 committed by Nicolas De loof
parent 6887a3fc3e
commit 7ffe83dc95
1 changed files with 5 additions and 12 deletions

View File

@ -104,7 +104,11 @@ func (s *composeService) Watch(ctx context.Context, project *types.Project, serv
return err
}
if config != nil && len(config.Watch) > 0 && service.Build == nil {
if config == nil {
continue
}
if len(config.Watch) > 0 && service.Build == nil {
// service configured with watchers but no build section
return fmt.Errorf("can't watch service %q without a build context", service.Name)
}
@ -118,17 +122,6 @@ func (s *composeService) Watch(ctx context.Context, project *types.Project, serv
continue
}
if config == nil {
config = &DevelopmentConfig{
Watch: []Trigger{
{
Path: service.Build.Context,
Action: WatchActionRebuild,
},
},
}
}
name := service.Name
dockerIgnores, err := watch.LoadDockerIgnore(service.Build.Context)
if err != nil {