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

Function dockerFilePath

pkg/compose/build_bake.go:556–576  ·  view source on GitHub ↗
(ctxName string, dockerfile string)

Source from the content-addressed store, hash-verified

554}
555
556func dockerFilePath(ctxName string, dockerfile string) string {
557 if dockerfile == "" {
558 return ""
559 }
560 contextType, _ := build.DetectContextType(ctxName)
561 if contextType == build.ContextTypeGit || contextType == build.ContextTypeRemote {
562 return dockerfile
563 }
564 if strings.Contains(ctxName, "://") {
565 return dockerfile
566 }
567 if !filepath.IsAbs(dockerfile) {
568 dockerfile = filepath.Join(ctxName, dockerfile)
569 }
570 dir := filepath.Dir(dockerfile)
571 symlinks, err := filepath.EvalSymlinks(dir)
572 if err == nil {
573 return filepath.Join(symlinks, filepath.Base(dockerfile))
574 }
575 return dockerfile
576}
577
578func (s *composeService) dryRunBake(cfg bakeConfig) map[string]string {
579 bakeResponse := map[string]string{}

Callers 3

doBuildBakeMethod · 0.85
doBuildImageMethod · 0.85
Test_dockerFilePathFunction · 0.85

Calls 1

DirMethod · 0.45

Tested by 1

Test_dockerFilePathFunction · 0.68