Skip to content

Support ContainerBaseImageTagSuffix for only modifying the suffix of inferred image tags #401

@baronfel

Description

@baronfel

May relate to #301.

Currently many containers have some sort of OS assumption baked into their 'default' tags, and the present various other decisions (OS, libc, etc) as sub-tags related to that base tag. Take the dotnet/aspnet image for example:
image

you've got:

  • the default debian bookworm image
  • alpine
  • alpine 3.17 (same alpine version, just more explicit)
  • slim debian bookworm
  • ubuntu jammy
  • slim ubuntu jammy

It would be great if we could keep most of the inference in place but allow users to switch OS/libc/etc with a suffix switch like ContainerBaseImageTagSuffix. The logic would be

  • If inferring a base image at all (meaning the user didn't provide a ContainerBaseImage)
  • and the ContainerBaseImageTagSuffix is present
  • ContainerBaseImage should be set to the inferred _ContainerBaseRegistry followed by the inferred _ContainerBaseImageName, with the inferred _ContainerBaseImageTag and finally the ContainerBaseImageTagSuffix:
<ContainerBaseImage Condition="'$(_ContainerIsUsingMicrosoftDefaultImages)' == 'true'">$(_ContainerBaseRegistry)/$(_ContainerBaseImageName):$(_ContainerBaseImageTag)$(ContainerBaseImageTagSuffix)</ContainerBaseImage>

This works great for the MS-supplied/inferred images, but it wouldn't work so well in the general case (when a user wants to set a base image and separately manage the tag suffix), therefore if the user isn't using our inference AND there is a ContainerBaseImage and ContainerBaseImageTagSuffix, then the two should be concat'd together.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: InferenceChanges to base image inference

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions