Răsfoiți Sursa

Merge pull request #9368 from ndeloof/links_dependencies

include services declared by `links` as implicit dependencies
Guillaume Lours 3 ani în urmă
părinte
comite
03aadcc85a
2 a modificat fișierele cu 5 adăugiri și 10 ștergeri
  1. 1 10
      pkg/compose/build_classic.go
  2. 4 0
      pkg/compose/create.go

+ 1 - 10
pkg/compose/build_classic.go

@@ -143,17 +143,8 @@ func (s *composeService) doBuildClassicSimpleImage(ctx context.Context, options
 		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)
-	var body io.Reader
-	if buildCtx != nil {
-		body = progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
-	}
+	body := progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
 
 	configFile := s.configFile()
 	creds, err := configFile.GetAllCredentials()

+ 4 - 0
pkg/compose/create.go

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