Loading ...

How To Add To Docker Image Dot Net Sdk And Other Useful Staff

Hello everybody,

today I want to write few rakes of Dockerfile.

First of all I want to document how to install dot net sdk 1.1. It isn't installable by chocolatey, so I had to use following workaround:

RUN Invoke-WebRequest 'https://download.microsoft.com/download/1/1/4/114223DE-0AD6-4B8A-A8FB-164E5862AF6E/dotnet-dev-win-x64.1.0.3.exe' -OutFile dotnetDev.exe
RUN .\dotnetDev.exe /Silent /Full

Another issue, that I faced was installing of Git, or for containers I prefer MinGit. It can be achieved in the following way:

RUN Invoke-WebRequest 'https://github.com/git-for-windows/git/releases/download/v2.12.2.windows.2/MinGit-2.12.2.2-64-bit.zip' -OutFile MinGit.zip

RUN Expand-Archive c:\MinGit.zip -DestinationPath c:\MinGit; \
$env:PATH = $env:PATH + ';C:\MinGit\cmd\;C:\MinGit\cmd'; \
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH

If you have need for dockerfile to execute powershell (as I like to do) the following command in docker file can be needed:

 

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]