Dockerfile for building blender.
References:
- By default, the image is for building Blender 3.4.0 (with Blender 3.4 release branch).
- See Diagnosing install failures if error occurred while installing Visual Studio Build Tools.
- Took more than 1 hour (me 1h44m) to build this image due to the size of the Blender libraries (16GB+).
- Final image size is 22.55GB.
docker build --memory 2GB -t blender-windows:3.4 -f "blender-windows.Dockerfile" .
- The container should be ready to build Blender.
- Default shell is CMD.
- At some point, the compiler consumes a lot of memory. (25.1GB in my build, is this normal?)
- Also, do give as many CPU as possible to speed things up.
- You may get
fatal error C1060: compiler is out of heap space
if container memory is not enough.
docker run --memory 30GB --cpus 24 --name blender-build -it blender-windows:3.4
To check memory size, run this powershell command
systeminfo | select-string 'Total Physical Memory'
To check CPU process count, run this powershell command
Get-WmiObject -class Win32_processor | Format-Table Name,NumberOfCores,NumberOfLogicalProcessors
And yes, the default shell is CMD, so you might want to call powershell
to run them and then exit
back to CMD.
Thanks to Git, we can use nano
when needed.
For example, building Blender as Python module
make.bat 2019b bpy
Note that 2019b
means Visual Studio 2019 Build Tools. We have to provide that or the script won't run.
After build complete, stop the container and copy files out.
docker cp blender-build:{path-to-build-dir} {dst}
For example
docker cp blender-build:C:/blender-build/build_windows_Bpy_x64_vc16_Release/bin/Release/bpy bpy