| James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 1 | # Building Thrift using Docker for Windows |
| 2 | |
| 3 | The build image is very large (just under 30GB) so plan accordingly. |
| 4 | Once Microsoft supports build tools in nano, it should get better. |
| 5 | |
| 6 | Install Docker for Windows and switch to Windows container mode. |
| 7 | |
| 8 | Pull from docker hub: |
| 9 | |
| 10 | PS C:\> docker pull thrift/thrift-build:msvc2017 |
| 11 | |
| 12 | or 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 | |
| 16 | The 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 | |
| 22 | You can override these as docker volumes if desired. |
| 23 | |
| 24 | ### Compiler |
| 25 | |
| 26 | To build a portable windows thrift compiler (with a statically linked |
| 27 | runtime) 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 | |
| 34 | The end result is a portable windows thrift compiler located at |
| 35 | |
| 36 | C:\Install\bin\thrift.exe |
| 37 | |
| 38 | If you run it through the [Dependency Walker](http://www.dependencywalker.com/) |
| 39 | you will see it only depends on KERNEL32.DLL which means the runtime is statically |
| 40 | linked, so the executable is portable and self-contained. This is how the |
| 41 | windows thrift compiler is built for each Apache Thrift release. |
| 42 | |
| 43 | ### Libraries |
| 44 | |
| 45 | To 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 |