Skip to content

Commit

Permalink
Reduce ue4-build-prerequisites Windows image (#144)
Browse files Browse the repository at this point in the history
This commit:

1. Replaces base image from mcr.microsoft.com/dotnet/framework/sdk to mcr.microsoft.com/windows/servercore
The former is 9GB while the latter is just 5GB.
dotnet/framework/sdk contains lots of things that are not actually needed to build ue4,
the hugest is VS Test Agent + VS Build Tools 2019 that take together 2.2GB

2. Stops installing unneeded VS Build Tools workloads/components and only installs required minimum:
* MSBuild (needed to build MSBuild-based UE4 tools, like UBT)
* NuGet (needed to run MSBuild)
* C# compiler (needed to build C# UE4 tools)
* .NET SDK 4.5 + 4.6.2 (same as above)
* Windows 10 SDK (needed to build C++ code)
* VCTools: C++ compiler, VC redist (same as above)

Cumulatively, this commit reduces ue4-build-prerequisites image from 24.5GB down to 10.7GB.
The most important consequence of this change is that it reduces ue4-minimal/ue4-full image sizes by the same amount
  • Loading branch information
slonopotamus authored May 18, 2021
1 parent b8bcf72 commit 2393cf8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ call refreshenv
@rem Forcibly disable the git credential manager
git config --system credential.helper "" || goto :error

@rem Install the Visual Studio 2017 Build Tools workloads and components we need, excluding components with known issues in containers
@rem Install the Visual Studio 2017 Build Tools workloads and components we need
@rem (Note that we use the Visual Studio 2019 installer here because the old installer now breaks, but explicitly install the VS2017 Build Tools)
curl --progress-bar -L "https://aka.ms/vs/16/release/vs_buildtools.exe" --output %TEMP%\vs_buildtools.exe || goto :error
%TEMP%\vs_buildtools.exe --quiet --wait --norestart --nocache ^
Expand All @@ -19,12 +19,14 @@ curl --progress-bar -L "https://aka.ms/vs/16/release/vs_buildtools.exe" --output
--installChannelUri "https://aka.ms/vs/15/release/channel" ^
--channelId VisualStudio.15.Release ^
--productId Microsoft.VisualStudio.Product.BuildTools ^
--add Microsoft.VisualStudio.Workload.VCTools;includeRecommended ^
--add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools;includeRecommended ^
--add Microsoft.VisualStudio.Workload.UniversalBuildTools ^
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools ^
--add Microsoft.VisualStudio.Workload.VCTools ^
--add Microsoft.VisualStudio.Workload.MSBuildTools ^
--add Microsoft.VisualStudio.Component.NuGet
--add Microsoft.VisualStudio.Component.NuGet ^
--add Microsoft.VisualStudio.Component.Roslyn.Compiler ^
--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ^
--add Microsoft.Net.Component.4.5.TargetingPack ^
--add Microsoft.Net.Component.4.6.2.SDK ^
--add Microsoft.Net.Component.4.6.2.TargetingPack
python C:\buildtools-exitcode.py %ERRORLEVEL% || goto :error

@rem Copy pdbcopy.exe to the expected location(s)
Expand Down
2 changes: 1 addition & 1 deletion ue4docker/infrastructure/BuildConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def _generateWindowsConfig(self):

# Store the tag for the base Windows Server Core image
self.basetag = self.args.basetag if self.args.basetag is not None else self.hostBasetag
self.baseImage = 'mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-' + self.basetag
self.baseImage = 'mcr.microsoft.com/windows/servercore:' + self.basetag
self.prereqsTag = self.basetag

# Verify that any user-specified base tag is valid
Expand Down

0 comments on commit 2393cf8

Please sign in to comment.