dotnet / sdk-container-builds

Libraries and build tooling to create container images from .NET projects using MSBuild

Home Page:https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tooling should validate the application's RID against the base image's os/architecture

baronfel opened this issue · comments

When we select an image during multi-image inference we do RID negotiation to select the best base image. This acts as a form of validation that the application assets can actually run on the base image chosen.

We don't do any such validation on the single-image scenario - we should add checks there and tell the user when the RID selected isn't compatible with the chosen base image, and tell them which RIDs would be compatible. The lack of this leads to user confusion (as seen in #498).

PR coming for this - here's the experience I've got so far:

dotnet publish -p PublishProfile=DefaultContainer -bl -r linux-x64 -f net7.0 -tl
MSBuild version 17.8.0-preview-23367-03+0ff2a83e9 for .NET
Restore complete (0.5s)

Build succeeded in 0.6s
  sdk-container-demo net7.0 failed with errors (2.3s) → bin\Debug\net7.0\ubuntu-x64\publish\
    ❌ D:\code\nuget-packages\microsoft.net.build.containers\8.0.100-dev\build\Microsoft.NET.Build.Containers.targets(202,5): error CONTAINER1011: The RuntimeIdentifier 'linux-x64' is not supported by kleymannl/dotnet-libfontconfig1:latest. The supported RuntimeIdentifiers are linux-arm64.

Build failed with errors in 2.5s

Note here that we are detecting the RID of the base image and validating it against the application's RID.