I am trying to build an ASP.net MVC project in a dockerfile in order to run in a container.
I tried using both the dotnet image and the servercore image in different dockerfiles whilst then using chocolately to install the other missing package and trying to build with msbuild but I'm stuck.
FROM microsoft/windowsservercore:10.0.14393.1480
SHELL ["powershell", "-Command", "$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue';"]
WORKDIR /appdir
EXPOSE 80
EXPOSE 443
COPY . /appdir/
COPY /ExFin.Web/packages.config /appdir/
ENV chocolateyUseWindowsCompression 'true'
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
RUN choco install visualstudio2019buildtools -y;
RUN choco install dotnet4.5.2 -Force -y;
RUN choco install nuget.commandline --pre
ENV NUGET_PATH "C:\Chocolatey\lib\NuGet.CommandLine.3.5.0\tools"
ENV MSBUILD_PATH "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin"
RUN $env:PATH = $env:NUGET_PATH + ';' + $env:MSBUILD_PATH + ';' + $env:PATH; `
RUN [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
RUN nuget.exe restore packages.config -PackagesDirectory /appdir/packages/
RUN ["C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\msbuild.exe", "C:/appdir/ExFin.Web/ExFin.Web.csproj"]
The error: Failures
- dotnetfx (exited -1073741502) - Error while running 'C:\ProgramData\chocolatey\lib\dotnetfx\tools\ChocolateyInstall.ps1'. See log for details.
- visualstudio2019buildtools (exited -1073741502) - Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2019buildtools\tools\ChocolateyInstall.ps1'. See log for details.
Could this mean that a restart is required??