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

Nightly test failure with AOT images #6049

Closed lbussell closed 5 days ago

lbussell commented 1 week ago

Error message

 Error loading shared library libstdc++.so.6: No such file or directory (needed by ./app)

Repro steps

My suspicion is that the project template web is not going to work by default for AOT. It should be webapiaot instead. The tests should be updated for this.

Create project:

docker run --name 8.0-create-web-133759161689369714 -w /app --platform linux/amd64 mcr.microsoft.com/dotnet/nightly/sdk:8.0-alpine3.20-aot-amd64 dotnet new web --framework net8.0 --no-restore --exclude-launch-settings

Dockerfile:

 ARG sdk_image
 ARG runtime_image
 ARG runtime_deps_image

 FROM $sdk_image AS build
 ARG rid
 ARG InternalAccessToken
 ARG port
 EXPOSE $port
 WORKDIR /source
 COPY NuGet.config .

 WORKDIR /source/app
 COPY app/*.csproj .
 RUN dotnet restore -r $rid
 COPY app/ .
 RUN dotnet build --no-restore

 FROM build AS publish
 ARG rid
 RUN dotnet publish -r $rid -c Release --self-contained true -o out

 FROM $runtime_deps_image AS app
 ARG port
 EXPOSE $port
 WORKDIR /app
 COPY --from=publish /source/app/out ./
 ENTRYPOINT ["./app"]

Build image:

docker build -t test --target build --build-arg sdk_image=mcr.microsoft.com/dotnet/nightly/sdk:8.0-alpine3.20-aot-amd64 --build-arg port=8080 --build-arg runtime_deps_image=mcr.microsoft.com/dotnet/nightly/runtime-deps:8.0-alpine3.20-aot-amd64 --build-arg rid=linux-musl-x64 .
lbussell commented 5 days ago

Fixed in https://github.com/dotnet/dotnet-docker/pull/6065