|
| 1 | +FROM mcr.microsoft.com/windows/servercore:ltsc2019 |
| 2 | + |
| 3 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 4 | + |
| 5 | +# Install MSYS2 |
| 6 | + |
| 7 | +RUN echo "Downloading MSYS2" ; \ |
| 8 | + Invoke-WebRequest -UserAgent 'DockerCI' -outfile 7zsetup.exe http://www.7-zip.org/a/7z1604-x64.exe ; \ |
| 9 | + Invoke-WebRequest -UserAgent 'DockerCI' -outfile msys2-x86_64-latest.tar.xz http://repo.msys2.org/distrib/msys2-x86_64-latest.tar.xz |
| 10 | + |
| 11 | + |
| 12 | +RUN echo "Extracting MSYS2" ; \ |
| 13 | + Start-Process .\7zsetup -ArgumentList '/S /D=c:/7zip' -Wait ; \ |
| 14 | + C:\7zip\7z e msys2-x86_64-latest.tar.xz -Wait ; \ |
| 15 | + C:\7zip\7z x msys2-x86_64-latest.tar -o"C:\\" ; \ |
| 16 | + cmd /S /C "del /q *" |
| 17 | + |
| 18 | +RUN New-Item C:/temp -ItemType Directory; \ |
| 19 | + New-Item C:/data -ItemType Directory; \ |
| 20 | + New-Item C:/home -ItemType Directory; |
| 21 | +WORKDIR C:/temp |
| 22 | + |
| 23 | +## Install Python |
| 24 | + |
| 25 | +ENV PYTHON_VERSION 3.7.9 |
| 26 | +ENV PYTHON_RELEASE 3.7.9 |
| 27 | + |
| 28 | +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ |
| 29 | + Write-Host ('Downloading {0} ...' -f $url); \ |
| 30 | + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ |
| 31 | + Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ |
| 32 | + \ |
| 33 | + Write-Host 'Installing ...'; \ |
| 34 | +# https://docs.python.org/3.7/using/windows.html#installing-without-ui |
| 35 | + Start-Process python.exe -Wait \ |
| 36 | + -ArgumentList @( \ |
| 37 | + '/quiet', \ |
| 38 | + 'InstallAllUsers=1', \ |
| 39 | + 'TargetDir=C:\Python37', \ |
| 40 | + 'PrependPath=1', \ |
| 41 | + 'Shortcuts=0', \ |
| 42 | + 'Include_doc=0', \ |
| 43 | + 'Include_pip=0', \ |
| 44 | + 'Include_test=0' \ |
| 45 | + ); \ |
| 46 | + \ |
| 47 | +#the installer updated PATH, so we should refresh our local value |
| 48 | + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ |
| 49 | + \ |
| 50 | + Write-Host 'Verifying install ...'; \ |
| 51 | + Write-Host ' python --version'; python --version; \ |
| 52 | + \ |
| 53 | + Write-Host 'Removing ...'; \ |
| 54 | + Remove-Item python.exe -Force; \ |
| 55 | + \ |
| 56 | + Write-Host 'Complete.' |
| 57 | + |
| 58 | +# And pip |
| 59 | + |
| 60 | +# https://github.com/pypa/get-pip |
| 61 | +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py |
| 62 | +ENV PYTHON_GET_PIP_SHA256 421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e |
| 63 | + |
| 64 | +RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \ |
| 65 | + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ |
| 66 | + Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py'; \ |
| 67 | + Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256); \ |
| 68 | + if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) { \ |
| 69 | + Write-Host 'FAILED!'; \ |
| 70 | + exit 1; \ |
| 71 | + }; \ |
| 72 | + \ |
| 73 | + Write-Host ('Installing pip ...'); \ |
| 74 | + python get-pip.py \ |
| 75 | + --disable-pip-version-check \ |
| 76 | + --no-cache-dir \ |
| 77 | + ; \ |
| 78 | + Remove-Item get-pip.py -Force; \ |
| 79 | + \ |
| 80 | + Write-Host 'Verifying pip install ...'; \ |
| 81 | + pip --version; \ |
| 82 | + \ |
| 83 | + Write-Host 'Complete.' |
| 84 | + |
| 85 | +WORKDIR C:/home |
| 86 | + |
| 87 | +RUN Remove-Item C:\temp |
| 88 | + |
| 89 | +## Install Java |
| 90 | + |
| 91 | +ENV JAVA_HOME C:\\openjdk-8 |
| 92 | +RUN $newPath = ('{0}\bin;{1}' -f $env:JAVA_HOME, $env:PATH); \ |
| 93 | + Write-Host ('Updating PATH: {0}' -f $newPath); \ |
| 94 | + setx /M PATH $newPath; \ |
| 95 | + Write-Host 'Complete.' |
| 96 | + |
| 97 | +# https://adoptopenjdk.net/upstream.html |
| 98 | +# > |
| 99 | +# > What are these binaries? |
| 100 | +# > |
| 101 | +# > These binaries are built by Red Hat on their infrastructure on behalf of the OpenJDK jdk8u and jdk11u projects. The binaries are created from the unmodified source code at OpenJDK. Although no formal support agreement is provided, please report any bugs you may find to https://bugs.java.com/. |
| 102 | +# > |
| 103 | +ENV JAVA_VERSION 8u302 |
| 104 | +ENV JAVA_URL https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_windows_8u302b08.zip |
| 105 | +# https://github.com/docker-library/openjdk/issues/320#issuecomment-494050246 |
| 106 | +# > |
| 107 | +# > I am the OpenJDK 8 and 11 Updates OpenJDK project lead. |
| 108 | +# > ... |
| 109 | +# > While it is true that the OpenJDK Governing Board has not sanctioned those releases, they (or rather we, since I am a member) didn't sanction Oracle's OpenJDK releases either. As far as I am aware, the lead of an OpenJDK project is entitled to release binary builds, and there is clearly a need for them. |
| 110 | +# > |
| 111 | + |
| 112 | +RUN Write-Host ('Downloading {0} ...' -f $env:JAVA_URL); \ |
| 113 | + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ |
| 114 | + Invoke-WebRequest -Uri $env:JAVA_URL -OutFile 'openjdk.zip'; \ |
| 115 | +# TODO signature? checksum? |
| 116 | + \ |
| 117 | + Write-Host 'Expanding ...'; \ |
| 118 | + New-Item -ItemType Directory -Path C:\temp | Out-Null; \ |
| 119 | + Expand-Archive openjdk.zip -DestinationPath C:\temp; \ |
| 120 | + Move-Item -Path C:\temp\* -Destination $env:JAVA_HOME; \ |
| 121 | + Remove-Item C:\temp; \ |
| 122 | + \ |
| 123 | + Write-Host 'Removing ...'; \ |
| 124 | + Remove-Item openjdk.zip -Force; \ |
| 125 | + \ |
| 126 | + Write-Host 'Verifying install ...'; \ |
| 127 | + Write-Host ' java -version'; java -version; \ |
| 128 | + \ |
| 129 | + Write-Host 'Complete.' |
| 130 | + |
| 131 | +SHELL ["cmd", "/S", "/C"] |
| 132 | + |
| 133 | +RUN echo "Installing VS Build Tools" && \ |
| 134 | + curl -SL --output vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe \ |
| 135 | + && (start /w vs_buildtools.exe --quiet --wait --norestart --nocache modify \ |
| 136 | + --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" \ |
| 137 | + --add Microsoft.VisualStudio.Workload.AzureBuildTools \ |
| 138 | + --remove Microsoft.VisualStudio.Component.Windows10SDK.10240 \ |
| 139 | + --remove Microsoft.VisualStudio.Component.Windows10SDK.10586 \ |
| 140 | + --remove Microsoft.VisualStudio.Component.Windows10SDK.14393 \ |
| 141 | + --remove Microsoft.VisualStudio.Component.Windows81SDK \ |
| 142 | + || IF "%ERRORLEVEL%"=="3010" EXIT 0) \ |
| 143 | + && del /q vs_buildtools.exe |
| 144 | + |
| 145 | +RUN setx PATH "C:\msys64\usr\bin;%PATH%" |
| 146 | + |
| 147 | +RUN echo "Downloading Maven" && \ |
| 148 | + curl -L https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz -o apache-maven-3.6.3-bin.tar.gz && \ |
| 149 | + tar xzf apache-maven-3.6.3-bin.tar.gz && \ |
| 150 | + mv apache-maven-3.6.3 /c/. |
| 151 | + |
| 152 | +RUN setx PATH "%PATH%;C:\apache-maven-3.6.3\bin" |
| 153 | + |
| 154 | +RUN python -m pip install numpy six |
| 155 | + |
| 156 | +RUN echo Downloading Bazel && \ |
| 157 | + mkdir C:\bazel && \ |
| 158 | + curl.exe -L https://github.com/bazelbuild/bazel/releases/download/3.7.2/bazel-3.7.2-windows-x86_64.exe -o C:/bazel/bazel.exe --retry 10 |
| 159 | + |
| 160 | +ARG GPU=false |
| 161 | + |
| 162 | +ADD install_cuda.bat /install_cuda.bat |
| 163 | +RUN /install_cuda.bat |
| 164 | + |
| 165 | +ADD entrypoint.bat /entrypoint.bat |
| 166 | +ENTRYPOINT [ "/entrypoint.bat" ] |
| 167 | + |
| 168 | +ENV CI=true |
| 169 | + |
| 170 | +RUN pwd |
| 171 | + |
| 172 | +VOLUME "C:\temp\.m2" |
0 commit comments