I’m trying to configure a dockerfile for a .NET and React deployment (for testing anyways).
For testing (since I couldn’t get my own to work), I copied the code from here: https://github.com/StefanScherer/dockerfiles-windows/blob/main/node/12/nano/Dockerfile
That all runs fine.
I added my specific stuff at the bottom of that existing code which looks like:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env WORKDIR /src COPY . /src RUN dotnet restore "MyProject.csproj" #2 Build client-side artifacts WORKDIR /node COPY ./ClientApp /node RUN npm install RUN npm run build
The problem is the last two lines. It errors with
'npm' is not recognized as an internal or external command, operable program or batch file.
The last couple lines of the code from the github file includes:
ARG SETX=/M USER ContainerAdministrator RUN setx %SETX% PATH "%PATH%;C:nodejs;C:yarnbin;C:gitcmd;C:gitmingw64bin;C:gitusrbin" USER ContainerUser CMD [ "node.exe" ]
So I’m not sure why my npm command doesn’t work.
Source: Docker Questions