Reputation: 71
I want to add a native dependency to my Docker hosted Blazor Web Assembly application, but cannot build the Docker image, even though the application builds and runs perfectly well outside of Docker.
Below are steps that replicate the issue.
In Visual Studio 2022 create a default .NET 6 Blazor Web Assembly application
Add Docker support to the project
Edit the project file to require native linking, by adding the following line to <PropertyGroup> - <WasmBuildNative>True</WasmBuildNative>
Add a line to the Dockerfile to install the WASM tools - RUN dotnet workload install wasm-tools
Try to build the Docker image - 'Error: The command "emcc --version" exited with code 1.'
No other error details are provided.
Upvotes: 0
Views: 635
Reputation: 25622
Emscripten, which is used to do the compilation, requires python which isn't installed in the SDK image.
You can install it yourself in the build image by adding the line
RUN apt-get update && apt-get install -y python3
in your Dockerfile, somewhere before you do your dotnet build or publish.
Upvotes: 1