1# escape=`
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16FROM microsoft/dotnet-framework:4.7.1
17
18# Restore the default Windows shell for correct batch processing below.
19SHELL ["cmd", "/S", "/C"]
20
21# Install Build Tools excluding workloads and components with known issues.
22ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
23RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
24    --installPath C:\BuildTools `
25    --all `
26    --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 `
27    --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 `
28    --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 `
29    --remove Microsoft.VisualStudio.Component.Windows81SDK `
30 || IF "%ERRORLEVEL%"=="3010" EXIT 0
31RUN DEL C:\TEMP\vs_buildtools.exe
32
33# Install CMake
34ADD https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-win64-x64.msi C:\TEMP\cmake.msi
35RUN msiexec.exe /i C:\TEMP\cmake.msi /qn && `
36    SETX PATH "%PATH%;C:\Program Files\CMake\bin" && `
37    DEL C:\TEMP\cmake.msi
38
39# Install boost (for the thrift runtime library build)
40ADD https://boost.teeks99.com/bin/1.69.0/boost_1_69_0-msvc-14.1-64.exe C:\TEMP\boost.exe
41RUN C:\TEMP\boost.exe /DIR="C:\Libraries\boost_1_69_0" /SILENT && `
42    DEL C:\TEMP\boost.exe
43
44# Install chocolatey
45RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" `
46    -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command `
47    "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" `
48    && SETX PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
49
50# Install winflexbison (for the thrift compiler build)
51RUN choco install winflexbison3 -y
52
53# Install 7zip and curl (used by the libevent and zlib build scripts)
54RUN choco install 7zip curl -y
55
56# Install libevent
57COPY appveyor\build-libevent.bat C:\TEMP\build-libevent.bat
58ENV LIBEVENT_VERSION=2.1.8
59ENV WIN3P=C:\TEMP\WIN3P
60RUN C:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 && `
61    MKDIR C:\TEMP\WIN3P && `
62    C:\TEMP\build-libevent.bat && `
63    MKDIR C:\Libraries\libevent-%LIBEVENT_VERSION% && `
64    MOVE C:\TEMP\WIN3P\libevent-%LIBEVENT_VERSION%-stable\include C:\Libraries\libevent-%LIBEVENT_VERSION% && `
65    MOVE C:\TEMP\WIN3P\libevent-%LIBEVENT_VERSION%-stable\lib C:\Libraries\libevent-%LIBEVENT_VERSION% && `
66    RMDIR /S /Q C:\TEMP\WIN3P
67
68# Install zlib
69COPY appveyor\build-zlib.bat C:\TEMP\build-zlib.bat
70ENV ZLIB_VERSION=1.2.11
71ENV WIN3P=C:\TEMP\WIN3P
72RUN C:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 && `
73    MKDIR C:\TEMP\WIN3P && `
74    C:\TEMP\build-zlib.bat && `
75    MOVE C:\TEMP\WIN3P\zlib-inst C:\Libraries\zlib-%ZLIB_VERSION% && `
76    RMDIR /S /Q C:\TEMP\WIN3P
77
78# Install OpenSSL 1.1.0
79ADD http://slproweb.com/download/Win64OpenSSL-1_1_0j.exe C:\TEMP\openssl.exe
80RUN C:\TEMP\openssl.exe /silent && `
81    DEL C:\TEMP\openssl.exe
82
83# Install java
84RUN choco install jdk8 -y
85
86# Install python3
87RUN choco install python3 -y
88
89# Install Adobe Flex 4.6 SDK and set FLEX_HOME so it can be found
90ADD http://download.macromedia.com/pub/flex/sdk/flex_sdk_4.6.zip C:\Adobe\Flex\SDK\4.6\SDK.zip
91RUN CD C:\Adobe\Flex\SDK\4.6 && `
92    7z x SDK.zip && `
93    DEL SDK.zip && `
94    SETX FLEX_HOME "C:\Adobe\Flex\SDK\4.6"
95
96# Start developer command prompt with any other commands specified.
97ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 &&
98
99# Default to PowerShell if no other command specified.
100CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
101