dotnet / dotnet-docker

Docker images for .NET and the .NET Tools.
https://hub.docker.com/_/microsoft-dotnet
MIT License
4.5k stars 1.94k forks source link

Reconsider supporting aspnet and runtime chiseled-aot and chiseled-extra for Ubuntu #5014

Closed Cjewett closed 10 months ago

Cjewett commented 1 year ago

We ran into an issue recently where we swapped to jammy-chiseled images for our applications and got an error where Microsoft.SqlClient routinely failed. It doesn't support Globalization Invariant Mode and you can set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT to true or false and it won't work in either scenario with jammy-chiseled. aspnet and runtime jammy-chiseled-extra would have solved the problem while keeping dependencies to a minimum though.

https://github.com/dotnet/SqlClient/issues/2206 https://github.com/dotnet/SqlClient/issues/220

dotnet-issue-labeler[bot] commented 1 year ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

JiriZidek commented 1 year ago

CodePages (ICU) and TZ tzdata are needed. Might be there a guide how to add them to a resulting image ?

DanielLaberge commented 1 year ago

Please consider providing these image variants. Globalization is unfortunately required in a Web Frontend in order to render localized dates and numbers, and to make use of .resx files.

Related discussion: https://github.com/dotnet/dotnet-docker/issues/4955

JiriZidek commented 1 year ago

AOT image, as well as distroless images in general

In fact ASP.NET 8 does not support common app: AUTH, MVC or SIGNALR are not compatible - thus AOT looks like a dead-end when considering chiseled image. For me docker file example how to add globalisation support but not using AOT and trimming would be helpful.

JiriZidek commented 1 year ago

So this is all the magic ? What parametr makes is ? I do not understand how ICU and TZ sneak inside the image ?

FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
WORKDIR /source

COPY . .
RUN dotnet publish --sc -p PublishTrimmed=true -o /app

# final stage/image
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-jammy-chiseled-extra
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["./globalapp"]
JiriZidek commented 1 year ago

They are installed directly in the -extra variant image

Aha ! That's what I have been voting for ! So it really exists. This was from MSFT communication not clear to me. I thought it was just an idea... Thx

orjan commented 1 year ago

If we're doing a self contained we will ship the framework itself for every single build for every application, hence the request for the -extra image with batteries included. The would mean that we'll only ship the application for every build and application. We can't just look at a single build in isolation.

logicaloud commented 1 year ago

Adding my vote. We use a shared framework deployment for a number of similar containers and several need ICU/TZDATA. Ideally they would share the same base image, i.e. "aspnet-jammy-chiseled-extra". Currently we manually build our own "extra" base image along the lines of #21, but would very much prefer an official source of such an image. Then we know it is up-to-date, without also diving into build triggers, etc., to keep the hand-crafted base image up-to-date with latest security patches

nikolai-mb commented 12 months ago

We have several microservices all using EF Core which requires ICU through the SqlClient dependency. Having a aspnet/jammy-chiseled-extra image would allow us to slice 40+ MB of every single container by not using self contained publish.

Are projects using EF Core (or SqlClient) really in such a minority that the aspnet variant is not justified? Looked at 10 services so far and only one can use the aspnet/jammy-chiseled variant, all others are using either EF Core or Hangfire with a SqlClient dependency.

lbussell commented 12 months ago

Hi folks, we're working on the Ubuntu Chiseled .NET Runtime/ASP.NET Core images now thanks to your feedback. You can track the work in https://github.com/dotnet/dotnet-docker/issues/5021. You should expect these to ship and be officially supported with the January .NET 8 servicing release.

lbussell commented 11 months ago

[Triage] These images are available in the nightly aspnet and nightly runtime repos now. They will be officially supported with the next .NET servicing release (Jan).

preardon commented 11 months ago

I need TZData as well, ICU could also be helpful

joegoldman2 commented 11 months ago

Hi folks, we're working on the Ubuntu Chiseled .NET Runtime/ASP.NET Core images now thanks to your feedback. You can track the work in #5021. You should expect these to ship and be officially supported with the January .NET 8 servicing release.

Great news!

I see that the .NET Runtime/ASP.NET Core distroless images with globalization support (-extra variant) are only available with Ubuntu Chiseled. Do you also plan cbl-mariner or alpine? And more generally, is there a guideline available regarding the choice of the distribution to use?

lbussell commented 11 months ago

Do you also plan cbl-mariner or alpine? And more generally, is there a guideline available regarding the choice of the distribution to use?

[Triage] @joegoldman2, there are no plans currently to add -extra images for Alpine or Azure Linux (CBL Mariner) runtime and aspnet images. For Alpine, it's easy to add new packages using APK if needed. Between Azure Linux and Chiseled, our goal was to take a targeted approach and only offer images that are actively in demand by the community.

There is currently no guidance for choosing between the distros we offer. The closest we have is the Supported Platforms documentation, but that's more about what we offer. @mthalman or I will file an issue to create some guidance there.

lbussell commented 10 months ago

These images are now available in the main aspnet and runtime repos. Please see the announcement: Ubuntu Chiseled runtime and aspnet images are now available in the extra variant (#5092).