Skip to content

Instantly share code, notes, and snippets.

@judavi
Created February 7, 2018 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save judavi/d7c638f4237b194a73f7d93953aa7883 to your computer and use it in GitHub Desktop.
Save judavi/d7c638f4237b194a73f7d93953aa7883 to your computer and use it in GitHub Desktop.
Ms Build tools 2017 Docker Image
FROM microsoft/windowsservercore:10.0.14393.1358
ENV WINDOWS_IMAGE_VERSION=10.0.14393
#############
# vs_buildtools.exe --layout D:\vsoffline --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.WebBuildTools --add Microsoft.VisualStudio.Workload.NetCoreBuildTools --includeOptional --lang en-US
#############
COPY ./vsoffline/ C:/TEMP/
ENV chocolateyUseWindowsCompression=false
COPY ./install.ps1 C:/
RUN @powershell -NoProfile -ExecutionPolicy Bypass .\install.ps1 && SET PATH="%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco config set cachelocation C:\chococache
# Use PowerShell commands to download, validate hashes, etc.
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Get-ChildItem -Path C:\TEMP\certificates\manifestCounterSignCertificates.p12 | Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root\ ; \
Get-ChildItem -Path C:\TEMP\certificates\manifestSignCertificates.p12 | Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root\ ; \
Get-ChildItem -Path C:\TEMP\certificates\vs_installer_opc.SignCertificates.p12 | Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root\ ;
# Download tools to C:\Bin and install Build Tools excluding workloads and components with known issues.
RUN $p = Start-Process -Wait -PassThru -FilePath C:\TEMP\vs_buildtools.exe -ArgumentList '--quiet --wait --norestart --noUpdateInstaller --noWeb --installPath C:\BuildTools --all --includeOptional --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 --remove Microsoft.VisualStudio.Component.Windows81SDK'; \
if (($ret = $p.ExitCode) -and ($ret -ne 3010)) { C:\TEMP\collect.exe; throw ('Install failed with exit code 0x{0:x}' -f $ret) }
RUN Remove-Item C:\TEMP\ -recurse
# Restore default shell for Windows containers.
SHELL ["cmd", "/S", "/C"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment