mirror of
https://github.com/docker/compose.git
synced 2025-07-23 13:45:00 +02:00
setting buildOptions.Services triggers image to be always rebuilt
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
769b7391ba
commit
b3207c455d
@ -282,7 +282,7 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op
|
|||||||
|
|
||||||
var buildForRun *api.BuildOptions
|
var buildForRun *api.BuildOptions
|
||||||
if !createOpts.noBuild {
|
if !createOpts.noBuild {
|
||||||
bo, err := buildOpts.toAPIBuildOptions(project.ServiceNames())
|
bo, err := buildOpts.toAPIBuildOptions(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -176,24 +176,9 @@ func applyRunOptions(project *types.Project, service *types.ServiceConfig, opts
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *composeService) startDependencies(ctx context.Context, project *types.Project, options api.RunOptions) error {
|
func (s *composeService) startDependencies(ctx context.Context, project *types.Project, options api.RunOptions) error {
|
||||||
dependencies := types.Services{}
|
project = project.WithServicesDisabled(options.Service)
|
||||||
var requestedService types.ServiceConfig
|
|
||||||
for name, service := range project.Services {
|
|
||||||
if name != options.Service {
|
|
||||||
dependencies[name] = service
|
|
||||||
} else {
|
|
||||||
requestedService = service
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(dependencies) > 0 {
|
err := s.Create(ctx, project, api.CreateOptions{
|
||||||
project.Services = dependencies
|
|
||||||
project.DisabledServices[options.Service] = requestedService
|
|
||||||
}
|
|
||||||
project.DisabledServices[options.Service] = requestedService
|
|
||||||
delete(project.Services, options.Service)
|
|
||||||
|
|
||||||
err = s.Create(ctx, project, api.CreateOptions{
|
|
||||||
Build: options.Build,
|
Build: options.Build,
|
||||||
IgnoreOrphans: options.IgnoreOrphans,
|
IgnoreOrphans: options.IgnoreOrphans,
|
||||||
RemoveOrphans: options.RemoveOrphans,
|
RemoveOrphans: options.RemoveOrphans,
|
||||||
@ -203,7 +188,7 @@ func (s *composeService) startDependencies(ctx context.Context, project *types.P
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(dependencies) > 0 {
|
if len(project.Services) > 0 {
|
||||||
return s.Start(ctx, project.Name, api.StartOptions{
|
return s.Start(ctx, project.Name, api.StartOptions{
|
||||||
Project: project,
|
Project: project,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user