Пытаюсь впервые развернуть приложение в докере. При создании приложения выбрал шаблон Angular application.
Вот мой Dockerfile:
# escape=`
ARG NODE_IMAGE=node:10.16.0
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["DbFirstProj/DbFirstProj.csproj", "DbFirstProj/"]
RUN dotnet restore "DbFirstProj/DbFirstProj.csproj"
COPY . .
WORKDIR "/src/DbFirstProj"
RUN dotnet build "DbFirstProj.csproj" -c Release -o /app
RUN dotnet publish "DbFirstProj.csproj" -c Release -o /app
COPY --from=downloadnodejs C:\Program Files\nodejs\ C:\Windows\system32\
FROM ${NODE_IMAGE} as node-build
WORKDIR /src
COPY DbFirstProj/ClientApp .
RUN npm install
RUN npm rebuild node-sass
RUN npm run build -- --prod
COPY --from=downloadnodejs C:\Program Files\nodejs\ C:\Windows\system32\
FROM mcr.microsoft.com/powershell:nanoserver-1903 AS downloadnodejs
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"]
RUN Invoke-WebRequest -OutFile nodejs.zip -UseBasicParsing "https://nodejs.org/dist/v10.16.3/node-v10.16.3-win-x64.zip"; `
Expand-Archive nodejs.zip -DestinationPath C:\; `
Rename-Item "C:\node-v10.16.3-win-x64" c:\nodejs
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
COPY --from=build /app .
COPY --from=node-build /src/dist ./ClientApp/dist
ENTRYPOINT ["dotnet", "DbFirstProj.dll"]
При запуске команды docker build -t arthur12345/dbfirstproj . Получаю след ошибку:
'npm' is not recognized as an internal or external command,
operable program or batch file.
C:\src\DbFirstProj\DbFirstProj.csproj(55,5): error MSB3073: The command "npm install" exited with code 9009.
Каким образом можно исправить эту ошибку? Возможно изменить мой Dockerfile?