sdk: `wasm-tools` workload breaks `dotnet publish` on Alpine Linux .NET SDK container image
Describe the bug
I am developing a Blazor WASM Application. I want to use the .NET 6 introduced Native Build for Sqlite (A nice package is delivered by this nice guy: https://github.com/JeremyLikness/SqliteWasmHelper).
To activate the Native Build Feature I need to install wasm-tools workload.
Developing on my Host machine works fine, but when I try to dockerize this, it comes to errors, especially setting the configuration as dotnet publish parameter in combination with installing the WASM-Tools: ✅ Not installing WASM Tools is working ✅ Installing WASM Tools without dotnet publish parameters is working 🚫 Installing WASM Tools and using dotnet publish parameters is not working
Please see my examples to reproduce for further details.
To Reproduce
✅ Not installing WASM Tools is working
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine
#RUN dotnet workload install wasm-tools
WORKDIR /app
RUN dotnet new blazorwasm -o BlazorEmpty
WORKDIR /app/BlazorEmpty
#RUN dotnet publish
RUN dotnet publish --configuration Release
✅ Installing WASM Tools without dotnet publish parameters is working
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine
RUN dotnet workload install wasm-tools
WORKDIR /app
RUN dotnet new blazorwasm -o BlazorEmpty
WORKDIR /app/BlazorEmpty
RUN dotnet publish
# RUN dotnet publish --configuration Release
🚫 Installing WASM Tools and using dotnet publish parameters is not working
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine
RUN dotnet workload install wasm-tools
WORKDIR /app
RUN dotnet new blazorwasm -o BlazorEmpty
WORKDIR /app/BlazorEmpty
# RUN dotnet publish
RUN dotnet publish --configuration Release
The last scenario should work imo. I get the following error:
> [6/6] RUN dotnet publish --configuration Release:
#0 0.551 MSBuild version 17.5.1+f6fdcf537 for .NET
#0 1.972 Determining projects to restore...
#0 3.204 All projects are up-to-date for restore.
#0 8.343 BlazorEmpty -> /app/BlazorEmpty/bin/Release/net7.0/BlazorEmpty.dll
#0 8.345 BlazorEmpty (Blazor output) -> /app/BlazorEmpty/bin/Release/net7.0/wwwroot
#0 8.526 Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
#0 8.531 Optimizing assemblies for size. This process might take a while.
#0 12.77 Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
#0 12.80 /bin/sh: /tmp/MSBuildTemproot/tmp2b43989dc6514e5c8ed88e234186b25d.exec.cmd: line 2: /usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.browser-wasm/7.0.5/Sdk/../tools/mono-aot-cross: not found
#0 12.80 /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/7.0.5/Sdk/WasmApp.Native.targets(283,5): error MSB3073: The command ""/usr/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.browser-wasm/7.0.5/Sdk/../tools/mono-aot-cross" --print-icall-table > "/app/BlazorEmpty/obj/Release/net7.0/wasm/for-publish/runtime-icall-table.h"" exited with code 127. [/app/BlazorEmpty/BlazorEmpty.csproj]
It tells me mono-aot-cross: not found is not found and docker exited with code 127 (file in container not found), but the file is available.
Further technical details
- Please let me know if you need any further technical details.
- I’ve tested this on Docker for MacOS and Linux (Ubuntu)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (22 by maintainers)
Commits related to this issue
- Remove libatomic from alpine Due to https://github.com/dotnet/sdk/issues/32327 — committed to lbussell/dotnet-docker by lbussell 3 years ago
Yeah, unfortunately this is still a known issue for .NET 8 on Alpine. @lewing, @directhex, @baronfel should we consider backporting the fix to 8.0?
@boukenka, in the meantime, if you are only using BlazorWASM as a frontend, since the output is a static web app, could you use one of the other distros we provide containers for? Such as
noble(Ubuntu) instead ofalpine3.20. The distro you built with shouldn’t make a big difference if you only depend on the static webapp output. Obviously if your project is more complicated and you’re depending on Alpine for hosting your app, then it might not be that simple.@lbussell we’re currently waiting on https://github.com/dotnet/runtime/pull/96483 to merge, then the next runtime build of the main branch from that point should be fixed
Closing as completed since this is fixed from what I can tell.
Ah. Looks like a required change in emsdk.git was missed (the corresponding change in runtime.git was done). I just filed https://github.com/dotnet/emsdk/pull/633
https://github.com/dotnet/runtime/pull/87841
@lewing it does exist on disk, but the thing that’s happening is the
linux-x64version of the pack is being downloaded, not thelinux-musl-x64version. As a result, themono-aot-crossbinary doesn’t launch and we get the ‘not found’ message (which is really a ‘couldn’t launch’ message).