Last post Nov 12, 2019 06:50 PM by bruce (sqlwork.com)
Nov 07, 2019 09:25 AM|IamGuy84|LINK
I have created Asp.net core 3 with Angular (Default Template) and I added docker Windows Container.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-nanoserver-1903 AS base
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-nanoserver-1903 AS build
COPY ["NewAngularDocker/NewAngularDocker.csproj", "NewAngularDocker/"]
RUN dotnet restore "NewAngularDocker/NewAngularDocker.csproj"
COPY . .
RUN dotnet build "NewAngularDocker.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "NewAngularDocker.csproj" -c Release -o /app/publish
FROM base AS final
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NewAngularDocker.dll"]
I run Docker and I am getting error message and it says:
could you please advise how to resolve this issue?
Thanks in Advance.
Nov 07, 2019 02:41 PM|maherjendoubi|LINK
There are 2 things missing in your Dockerfile:
Nov 07, 2019 10:55 PM|bruce (sqlwork.com)|LINK
you also need a node install.
Nov 11, 2019 05:54 AM|IamGuy84|LINK
Thank you for your response.
I tried google search but same error and still no clue.
Could you kindly share the source code?
Nov 11, 2019 07:18 PM|maherjendoubi|LINK
Please grab the LTS version of nodejs from here
https://nodejs.org/en/ and install it on the hosting machine.
The Dockerfile seems to be perfect.
Nov 11, 2019 07:22 PM|maherjendoubi|LINK
Please hold on I reproduced the issue.
AggregateException: One or more errors occurred. (One or more errors occurred. (The NPM script 'start' exited without indicating that the Angular CLI was listening for requests. The error output was: 'npm' is not recognized as an internal or external command,
Nov 11, 2019 08:36 PM|bruce (sqlwork.com)|LINK
most likely you need to add the node bin folder to the path.
ENV PATH /app/node_modules/.bin:$PATH
you should attach to the container, and check what is installed and where
Nov 12, 2019 11:38 AM|IamGuy84|LINK
I have already installed node in my host machine.
Where should i place it in docker file? I do not get it.
I tried this:
..........FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-nanoserver-1903 AS base
ENV PATH /app/node_modules/.bin:$PATH...................
Same error message
Nov 12, 2019 03:15 PM|bruce (sqlwork.com)|LINK
But as you are trying to run node in the container, you need to install node in the container. I did not notice that it’s a windows container. Google for instructions for the window container.
note: if you built the release on the host machine rather than in the container, you would not need node installed in the container. But as you are doing the build in the container, you need all the build tools installed in the container.
Nov 12, 2019 03:31 PM|maherjendoubi|LINK
It looks like this feature is not implemented yet for ASP.NET Core 3.0. It is added to the backlog of ASP.NET 5.0.0-preview1 :
Nov 12, 2019 06:50 PM|bruce (sqlwork.com)|LINK
you just need to install node in the container. Its pretty common and lots of examples for standard linux containers (which use apt-get), but you will need to find the instructions for installing node in a windows container (which I have never used).