MCPcopy
hub / github.com/docker/compose / checkOnlyBuildSection

Method checkOnlyBuildSection

pkg/compose/publish.go:653–669  ·  view source on GitHub ↗
(project *types.Project)

Source from the content-addressed store, hash-verified

651}
652
653func (s *composeService) checkOnlyBuildSection(project *types.Project) (bool, error) {
654 errorList := []string{}
655 for _, service := range project.Services {
656 if service.Image == "" && service.Build != nil {
657 errorList = append(errorList, service.Name)
658 }
659 }
660 if len(errorList) > 0 {
661 var errMsg strings.Builder
662 errMsg.WriteString("your Compose stack cannot be published as it only contains a build section for service(s):\n")
663 for _, serviceInError := range errorList {
664 fmt.Fprintf(&errMsg, "- %q\n", serviceInError)
665 }
666 return false, errors.New(errMsg.String())
667 }
668 return true, nil
669}
670
671func (s *composeService) checkForBindMount(project *types.Project) map[string][]types.ServiceVolumeConfig {
672 allFindings := map[string][]types.ServiceVolumeConfig{}

Callers 1

preChecksMethod · 0.95

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected