Skip to content

Commit fd28ab8

Browse files
authored
Merge pull request docker#10399 from ndeloof/watch_rebuild
watch involves up --build after change has been detected
2 parents 925bc6f + d637cc3 commit fd28ab8

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

pkg/compose/watch.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ func loadDevelopmentConfig(service types.ServiceConfig, project *types.Project)
255255
}
256256

257257
func (s *composeService) makeRebuildFn(ctx context.Context, project *types.Project) func(services rebuildServices) {
258+
for i, service := range project.Services {
259+
service.PullPolicy = types.PullPolicyBuild
260+
project.Services[i] = service
261+
}
258262
return func(services rebuildServices) {
259263
serviceNames := make([]string, 0, len(services))
260264
allPaths := make(utils.Set[string])
@@ -271,20 +275,7 @@ func (s *composeService) makeRebuildFn(ctx context.Context, project *types.Proje
271275
strings.Join(serviceNames, ", "),
272276
strings.Join(append([]string{""}, allPaths.Elements()...), "\n - "),
273277
)
274-
imageIds, err := s.build(ctx, project, api.BuildOptions{
275-
Services: serviceNames,
276-
})
277-
if err != nil {
278-
fmt.Fprintf(s.stderr(), "Build failed\n")
279-
}
280-
for i, service := range project.Services {
281-
if id, ok := imageIds[service.Name]; ok {
282-
service.Image = id
283-
}
284-
project.Services[i] = service
285-
}
286-
287-
err = s.Up(ctx, project, api.UpOptions{
278+
err := s.Up(ctx, project, api.UpOptions{
288279
Create: api.CreateOptions{
289280
Services: serviceNames,
290281
Inherit: true,

0 commit comments

Comments
 (0)