Skip to content

Commit 52d3a1d

Browse files
committed
[windows-build] (.NET 4.0) new style dockerfile on windowsservercore,
with Build Tools 2017
1 parent 9ab4788 commit 52d3a1d

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# escape=`
2+
3+
FROM microsoft/windowsservercore:10.0.14393.2312
4+
LABEL maintainer="xied75@gmail.com"
5+
6+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
7+
8+
# Install NuGet CLI
9+
ENV NUGET_VERSION 4.7.0
10+
RUN New-Item -Type Directory $Env:ProgramFiles\NuGet; `
11+
Invoke-WebRequest -UseBasicParsing https://dist.nuget.org/win-x86-commandline/v$Env:NUGET_VERSION/nuget.exe -OutFile $Env:ProgramFiles\NuGet\nuget.exe;
12+
13+
RUN New-Item -Type Directory c:\install_logs; `
14+
# install Microsoft .NET Framework 4 Multi-Targeting Pack 4.0.30319
15+
Invoke-WebRequest -UseBasicParsing https://download.visualstudio.microsoft.com/download/pr/10661178/e654115b07b2b9ea7883d5fe702f153a/netfx_dtp.msi -OutFile netfx_dtp.msi; `
16+
Invoke-WebRequest -UseBasicParsing https://download.visualstudio.microsoft.com/download/pr/10661178/e654115b07b2b9ea7883d5fe702f153a/netfx_dtp.cab -OutFile netfx_dtp.cab; `
17+
Start-Process -FilePath msiexec.exe -ArgumentList /i, 'C:\netfx_dtp.msi', EXTUI=1, /qn, /L, c:\install_logs\netfx_dtp.msi.install.log -PassThru -Wait; `
18+
Remove-Item netfx_dtp.msi; `
19+
Remove-Item netfx_dtp.cab; `
20+
# install Build Tools 2017
21+
Invoke-WebRequest -UseBasicParsing https://download.visualstudio.microsoft.com/download/pr/c6e2b90d-9051-44bd-aef1-4ef3bdf8f084/30b5724c490239eee9608d63225b994f/vs_buildtools.exe -OutFile vs_buildtools.exe; `
22+
# Installer won't detect DOTNET_SKIP_FIRST_TIME_EXPERIENCE if ENV is used, must use setx /M
23+
setx /M DOTNET_SKIP_FIRST_TIME_EXPERIENCE 1; `
24+
Start-Process -FilePath 'C:\vs_buildtools.exe' -ArgumentList '--add', 'Microsoft.VisualStudio.Workload.MSBuildTools', '--quiet', '--norestart', '--nocache' -NoNewWindow -Wait; `
25+
Remove-Item vs_buildtools.exe; `
26+
Remove-Item -Force -Recurse \"${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\"; `
27+
Remove-Item -Force -Recurse ${Env:TEMP}\*;
28+
29+
ENV ROSLYN_COMPILER_LOCATION "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn"
30+
31+
# ngen assemblies queued by VS installers - must be done in cmd shell to avoid access issues
32+
SHELL ["cmd", "/S", "/C"]
33+
RUN \Windows\Microsoft.NET\Framework64\v4.0.30319\ngen update `
34+
&& \Windows\Microsoft.NET\Framework\v4.0.30319\ngen update
35+
36+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
37+
38+
# Set PATH in one layer to keep image size down.
39+
RUN setx /M PATH $(${Env:PATH} `
40+
+ \";${Env:ProgramFiles}\NuGet\" `
41+
+ \";${Env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\")

0 commit comments

Comments
 (0)