MCPcopy Index your code
hub / github.com/dagger/dagger / extractImages

Function extractImages

sdk/python/runtime/image.go:109–136  ·  view source on GitHub ↗

extractImages reads from the bundled Dockerfile to extract the default docker image references.

()

Source from the content-addressed store, hash-verified

107// extractImages reads from the bundled Dockerfile to extract the default docker
108// image references.
109func extractImages() (map[string]Image, error) {
110 images := make(map[string]Image)
111 for _, dockerfile := range []string{baseDockerfile, uvDockerfile} {
112 lines := strings.Split(dockerfile, "\n")
113
114 for _, line := range lines {
115 if matches := fromLineRegex.FindStringSubmatch(strings.TrimSpace(line)); matches != nil {
116 ref := matches[1]
117 name := matches[2]
118
119 image, err := NewImage(ref)
120 if err != nil {
121 return nil, fmt.Errorf("parsing %q image ref: %w", name, err)
122 }
123
124 images[name] = image
125 }
126 }
127 }
128
129 for _, name := range baseImageNames {
130 if _, found := images[name]; !found {
131 return nil, fmt.Errorf("unable to find %q image ref", name)
132 }
133 }
134
135 return images, nil
136}

Callers 1

NewDiscoveryFunction · 0.85

Calls 1

NewImageFunction · 0.85

Tested by

no test coverage detected