Merge pull request #9368 from ndeloof/links_dependencies

include services declared by `links` as implicit dependencies
This commit is contained in:
Guillaume Lours 2022-04-11 11:59:25 +02:00 committed by GitHub
commit 03aadcc85a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View File

@ -143,17 +143,8 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options
return "", err return "", err
} }
// if up to this point nothing has set the context then we must have another
// way for sending it(streaming) and set the context to the Dockerfile
if dockerfileCtx != nil && buildCtx == nil {
buildCtx = dockerfileCtx
}
progressOutput := streamformatter.NewProgressOutput(progBuff) progressOutput := streamformatter.NewProgressOutput(progBuff)
var body io.Reader body := progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
if buildCtx != nil {
body = progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
}
configFile := s.configFile() configFile := s.configFile()
creds, err := configFile.GetAllCredentials() creds, err := configFile.GetAllCredentials()

View File

@ -173,6 +173,10 @@ func prepareServicesDependsOn(p *types.Project) error {
dependencies = append(dependencies, spec[0]) dependencies = append(dependencies, spec[0])
} }
for _, link := range service.Links {
dependencies = append(dependencies, strings.Split(link, ":")[0])
}
if len(dependencies) == 0 { if len(dependencies) == 0 {
continue continue
} }