MCPcopy
hub / github.com/dagger/dagger / parseBaseImage

Method parseBaseImage

sdk/python/runtime/discovery.go:444–465  ·  view source on GitHub ↗

parseBaseImage parses user configuration to look for an override of the base image. Base image is constructed on a best effort: 1. Override in custom `base-image` setting (in pyproject.toml) 2. Check `.python-version` contents 3. Check pinned version in requires-python (in pyproject.toml) 4. Use th

(defaultImage Image)

Source from the content-addressed store, hash-verified

442// WARNING: Using an image that deviates from the official slim Python image
443// is not supported and may lead to unexpected behavior. Use at own risk.
444func (d *Discovery) parseBaseImage(defaultImage Image) (Image, error) {
445 ref := d.UserConfig().BaseImage
446
447 if ref == "" {
448 version := d.findPythonVersion()
449 if version == "" {
450 return defaultImage, nil
451 }
452
453 tag := fmt.Sprintf("%s-slim", version)
454 image, err := defaultImage.WithTag(tag)
455
456 // If the image name and tag is the same as the default, reuse the default
457 // because of the digest.
458 if err != nil || image.Equal(defaultImage) {
459 return defaultImage, err
460 }
461
462 return image, nil
463 }
464 return NewImage(ref)
465}
466
467// parseUvImage parses user configuration to look for an override of the uv image.
468//

Callers 2

loadConfigMethod · 0.95
WithBaseImageMethod · 0.80

Calls 5

UserConfigMethod · 0.95
findPythonVersionMethod · 0.95
NewImageFunction · 0.85
WithTagMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected