Skip to content

Commit 587dba1

Browse files
authored
Merge pull request docker#11213 from glours/watch-force-build-at-startup
in watch mode force pull policy to build for services with both build and develop attributes
2 parents b1a26da + 2ba5e4c commit 587dba1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/compose/watch.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"context"
2121
"fmt"
2222

23+
"github.com/compose-spec/compose-go/types"
24+
2325
"github.com/docker/cli/cli/command"
2426
"github.com/docker/compose/v2/internal/locker"
2527
"github.com/docker/compose/v2/pkg/api"
@@ -85,6 +87,12 @@ func runWatch(ctx context.Context, dockerCli command.Cli, backend api.Service, w
8587
}
8688

8789
if !watchOpts.noUp {
90+
for index, service := range project.Services {
91+
if service.Build != nil && service.Develop != nil {
92+
service.PullPolicy = types.PullPolicyBuild
93+
}
94+
project.Services[index] = service
95+
}
8896
upOpts := api.UpOptions{
8997
Create: api.CreateOptions{
9098
Build: &build,

0 commit comments

Comments
 (0)