Browse Source

on up buildOptions must include all enabled services

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 4 tháng trước cách đây
mục cha
commit
c37ede62db
2 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 3 3
      cmd/compose/compose.go
  2. 1 1
      cmd/compose/up.go

+ 3 - 3
cmd/compose/compose.go

@@ -159,13 +159,13 @@ func (o *ProjectOptions) WithProject(fn ProjectFunc, dockerCli command.Cli) func
 
 // WithServices creates a cobra run command from a ProjectFunc based on configured project options and selected services
 func (o *ProjectOptions) WithServices(dockerCli command.Cli, fn ProjectServicesFunc) func(cmd *cobra.Command, args []string) error {
-	return Adapt(func(ctx context.Context, args []string) error {
+	return Adapt(func(ctx context.Context, services []string) error {
 		backend, err := compose.NewComposeService(dockerCli)
 		if err != nil {
 			return err
 		}
 
-		project, metrics, err := o.ToProject(ctx, dockerCli, backend, args, cli.WithoutEnvironmentResolution)
+		project, metrics, err := o.ToProject(ctx, dockerCli, backend, services, cli.WithoutEnvironmentResolution)
 		if err != nil {
 			return err
 		}
@@ -177,7 +177,7 @@ func (o *ProjectOptions) WithServices(dockerCli command.Cli, fn ProjectServicesF
 			return err
 		}
 
-		return fn(ctx, project, args)
+		return fn(ctx, project, services)
 	})
 }
 

+ 1 - 1
cmd/compose/up.go

@@ -263,7 +263,7 @@ func runUp(
 		if err != nil {
 			return err
 		}
-		bo.Services = services
+		bo.Services = project.ServiceNames()
 		bo.Deps = !upOptions.noDeps
 		build = &bo
 	}