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)
| 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. |
| 444 | func (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 | // |
no test coverage detected