Я использую ядро Asp. net с контейнером angular и docker windows. Вот dockerfile, как показано ниже:
Dockerfile:
#escape=`
FROM mcr.microsoft.com/powershell:nanoserver-1809 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-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
COPY --from=downloadnodejs C:\nodejs\ C:\Windows\system32\
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build
COPY --from=downloadnodejs C:\nodejs\ C:\Windows\system32\
WORKDIR /src
COPY ["DemoAngularWindows.csproj", "./"]
RUN dotnet restore "./DemoAngularWindows.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "DemoAngularWindows.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DemoAngularWindows.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DemoAngularWindows.dll"]
Я запускаю docker и никаких проблем. Но теперь я поместил репо в azure DevOps и создал docker build и pu sh образ для конвейеров реестра контейнеров. Я получаю сообщение об ошибке:
Invoke-WebRequest: Access to the path 'C:\nodejs.zip' is denied.
The command 'pwsh -Command $ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue'; 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' returned a non-zero code: 1
##[error]The process 'C:\Program Files\Docker\docker.exe' failed with exit code 1
Finishing: Build and push an image to container registry
azure -pipelines.yml:
trigger:
- master
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '43a885d5-3f2b-417d-9df3-eaac92ed0a20'
imageRepository: 'demoangularwindows'
containerRegistry: 'democontainerregistryname.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/DemoAngularWindows/Dockerfile'
tag: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'windows-2019'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
Ссылка: https://docs.microsoft.com/en-us/visualstudio/containers/container-tools-react?view=vs-2019#modify -the-dockerfile- windows -containers
Не могли бы вы помочь решить эту проблему?
Спасибо