1# Building Thrift using Docker for Windows 2 3The build image is very large (just under 30GB) so plan accordingly. 4Once Microsoft supports build tools in nano, it should get better. 5 6Install Docker for Windows and switch to Windows container mode. 7 8Pull from docker hub: 9 10 PS C:\> docker pull thrift/thrift-build:msvc2017 11 12or build in a docker for windows environment: 13 14 PS C:\Thrift> docker build -t thrift/thrift-build:msvc2017 -f build\docker\msvc2017\Dockerfile build\ 15 16The following directories are used inside the container: 17 18 C:\Build the out-of-tree build directory 19 C:\Install the install target directory 20 C:\Thrift the source tree 21 22You can override these as docker volumes if desired. 23 24### Compiler 25 26To build a portable windows thrift compiler (with a statically linked 27runtime) and get it placed into C:\install: 28 29 docker run -v C:\thrift:C:\thrift^ 30 -v C:\install:C:\install^ 31 --rm -t thrift/thrift-build:msvc2017^ 32 C:\thrift\build\docker\msvc2017\build-compiler.bat 33 34The end result is a portable windows thrift compiler located at 35 36 C:\Install\bin\thrift.exe 37 38If you run it through the [Dependency Walker](http://www.dependencywalker.com/) 39you will see it only depends on KERNEL32.DLL which means the runtime is statically 40linked, so the executable is portable and self-contained. This is how the 41windows thrift compiler is built for each Apache Thrift release. 42 43### Libraries 44 45To build, test everything and get the C++ SDK placed into C:\install: 46 47 docker run -v C:\thrift:C:\thrift^ 48 -v C:\install:C:\install^ 49 -m 4096 --rm -t thrift/thrift-build:msvc2017^ 50 C:\thrift\build\docker\msvc2017\build.bat