Skip to content

Commit

Permalink
Merge pull request #11213 from glours/watch-force-build-at-startup
Browse files Browse the repository at this point in the history
in watch mode force pull policy to build for services with both build and develop attributes
  • Loading branch information
glours authored Nov 22, 2023
2 parents b1a26da + 2ba5e4c commit 587dba1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/compose/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"fmt"

"github.com/compose-spec/compose-go/types"

"github.com/docker/cli/cli/command"
"github.com/docker/compose/v2/internal/locker"
"github.com/docker/compose/v2/pkg/api"
Expand Down Expand Up @@ -85,6 +87,12 @@ func runWatch(ctx context.Context, dockerCli command.Cli, backend api.Service, w
}

if !watchOpts.noUp {
for index, service := range project.Services {
if service.Build != nil && service.Develop != nil {
service.PullPolicy = types.PullPolicyBuild
}
project.Services[index] = service
}
upOpts := api.UpOptions{
Create: api.CreateOptions{
Build: &build,
Expand Down

0 comments on commit 587dba1

Please sign in to comment.