Im trying to run an angular .NET Core app via spa middleware in a docker container. When I create a new angular app in Visual Studio 2017 Pro and add docker support it initially fails because I need NPM installed. So I added the boiler plate code to install NodeJs I ripped from the net in my dockerfile:
(BTW: I did ng new ClientApp after removing the angular 5 one to have version 7 with css styles)
FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base # Setup NodeJs RUN apt-get update && apt-get install -y wget && apt-get install -y gnupg2 && wget -qO- https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y build-essential nodejs # End setup WORKDIR /app EXPOSE 80 EXPOSE 443 FROM microsoft/dotnet:2.2-sdk AS build # Setup NodeJs RUN apt-get update && apt-get install -y wget && apt-get install -y gnupg2 && wget -qO- https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y build-essential nodejs # End setup WORKDIR /src COPY ["A7NCDS/A7NCDS.csproj", "A7NCDS/"] RUN dotnet restore "A7NCDS/A7NCDS.csproj" COPY . . WORKDIR "/src/A7NCDS" RUN dotnet build "A7NCDS.csproj" -c Release -o /app FROM build AS publish RUN dotnet publish "A7NCDS.csproj" -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "A7NCDS.dll"]
When I run this in docker it all works fine! But now when I remove my ClientApp and do ng new ClientApp with SCSS support instead of CSS I get this error:
Error: Missing binding /app/ClientApp/node_modules/node-sass/vendor/linux-x64-67/binding.node Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 11.x Found bindings for the following environments: - Windows 64-bit with Node.js 11.x
So I did some googleFU and ended up placing npm rebuild node-sass in my Dockerfile somewhere which I lost now which just gave me the vague error without details: WDM failed to compile.
How do I make it work? Im so stuck right now. I did not make any changes to .csproj files or startup.cs. Im considering removing SCSS/SASS altogether but this is not a realistic pragmatic solution. (What if some other library becomes platform specific altogether?)