2022-10-12 16:30:54 +00:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
# Dockerfile for installing the necessary dependencies for building Hadoop.
|
|
|
|
# See BUILDING.txt.
|
|
|
|
|
|
|
|
FROM mcr.microsoft.com/windows:ltsc2019
|
|
|
|
|
|
|
|
# Need to disable the progress bar for speeding up the downloads.
|
|
|
|
# hadolint ignore=SC2086
|
|
|
|
RUN powershell $Global:ProgressPreference = 'SilentlyContinue'
|
|
|
|
|
|
|
|
# Restore the default Windows shell for correct batch processing.
|
|
|
|
SHELL ["cmd", "/S", "/C"]
|
|
|
|
|
|
|
|
# Install Visual Studio 2019 Build Tools.
|
|
|
|
RUN curl -SL --output vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe \
|
|
|
|
&& (start /w vs_buildtools.exe --quiet --wait --norestart --nocache \
|
|
|
|
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools" \
|
|
|
|
--add Microsoft.VisualStudio.Workload.VCTools \
|
|
|
|
--add Microsoft.VisualStudio.Component.VC.ASAN \
|
|
|
|
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
|
|
|
|
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 \
|
|
|
|
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) \
|
|
|
|
&& del /q vs_buildtools.exe
|
|
|
|
|
|
|
|
# Install Chocolatey.
|
2023-11-01 16:10:15 +00:00
|
|
|
ENV chocolateyVersion=1.4.0
|
2022-10-12 16:30:54 +00:00
|
|
|
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
|
|
|
|
|
|
|
|
# Install git.
|
|
|
|
RUN choco install git.install -y
|
|
|
|
RUN powershell Copy-Item -Recurse -Path 'C:\Program Files\Git' -Destination C:\Git
|
|
|
|
|
|
|
|
# Install vcpkg.
|
|
|
|
# hadolint ignore=DL3003
|
|
|
|
RUN powershell git clone https://github.com/microsoft/vcpkg.git \
|
|
|
|
&& cd vcpkg \
|
|
|
|
&& git checkout 7ffa425e1db8b0c3edf9c50f2f3a0f25a324541d \
|
|
|
|
&& .\bootstrap-vcpkg.bat
|
|
|
|
RUN powershell .\vcpkg\vcpkg.exe install boost:x64-windows
|
|
|
|
RUN powershell .\vcpkg\vcpkg.exe install protobuf:x64-windows
|
|
|
|
RUN powershell .\vcpkg\vcpkg.exe install openssl:x64-windows
|
|
|
|
RUN powershell .\vcpkg\vcpkg.exe install zlib:x64-windows
|
|
|
|
|
|
|
|
# Install Azul Java 8 JDK.
|
|
|
|
RUN powershell Invoke-WebRequest -URI https://cdn.azul.com/zulu/bin/zulu8.62.0.19-ca-jdk8.0.332-win_x64.zip -OutFile $Env:TEMP\zulu8.62.0.19-ca-jdk8.0.332-win_x64.zip
|
|
|
|
RUN powershell Expand-Archive -Path $Env:TEMP\zulu8.62.0.19-ca-jdk8.0.332-win_x64.zip -DestinationPath "C:\Java"
|
|
|
|
|
|
|
|
# Install Apache Maven.
|
2023-05-03 17:14:54 +00:00
|
|
|
RUN powershell Invoke-WebRequest -URI https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip -OutFile $Env:TEMP\apache-maven-3.8.6-bin.zip
|
2022-10-12 16:30:54 +00:00
|
|
|
RUN powershell Expand-Archive -Path $Env:TEMP\apache-maven-3.8.6-bin.zip -DestinationPath "C:\Maven"
|
|
|
|
|
|
|
|
# Install CMake 3.19.0.
|
|
|
|
RUN powershell Invoke-WebRequest -URI https://cmake.org/files/v3.19/cmake-3.19.0-win64-x64.zip -OutFile $Env:TEMP\cmake-3.19.0-win64-x64.zip
|
|
|
|
RUN powershell Expand-Archive -Path $Env:TEMP\cmake-3.19.0-win64-x64.zip -DestinationPath "C:\CMake"
|
|
|
|
|
2023-05-03 17:14:54 +00:00
|
|
|
# Install zstd 1.5.4.
|
|
|
|
RUN powershell Invoke-WebRequest -Uri https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-v1.5.4-win64.zip -OutFile $Env:TEMP\zstd-v1.5.4-win64.zip
|
|
|
|
RUN powershell Expand-Archive -Path $Env:TEMP\zstd-v1.5.4-win64.zip -DestinationPath "C:\ZStd"
|
|
|
|
RUN setx PATH "%PATH%;C:\ZStd"
|
|
|
|
|
|
|
|
# Install libopenssl 3.1.0 needed for rsync 3.2.7.
|
|
|
|
RUN powershell Invoke-WebRequest -Uri https://repo.msys2.org/msys/x86_64/libopenssl-3.1.0-1-x86_64.pkg.tar.zst -OutFile $Env:TEMP\libopenssl-3.1.0-1-x86_64.pkg.tar.zst
|
|
|
|
RUN powershell zstd -d $Env:TEMP\libopenssl-3.1.0-1-x86_64.pkg.tar.zst -o $Env:TEMP\libopenssl-3.1.0-1-x86_64.pkg.tar
|
|
|
|
RUN powershell mkdir "C:\LibOpenSSL"
|
|
|
|
RUN powershell tar -xvf $Env:TEMP\libopenssl-3.1.0-1-x86_64.pkg.tar -C "C:\LibOpenSSL"
|
|
|
|
|
|
|
|
# Install libxxhash 0.8.1 needed for rsync 3.2.7.
|
|
|
|
RUN powershell Invoke-WebRequest -Uri https://repo.msys2.org/msys/x86_64/libxxhash-0.8.1-1-x86_64.pkg.tar.zst -OutFile $Env:TEMP\libxxhash-0.8.1-1-x86_64.pkg.tar.zst
|
|
|
|
RUN powershell zstd -d $Env:TEMP\libxxhash-0.8.1-1-x86_64.pkg.tar.zst -o $Env:TEMP\libxxhash-0.8.1-1-x86_64.pkg.tar
|
|
|
|
RUN powershell mkdir "C:\LibXXHash"
|
|
|
|
RUN powershell tar -xvf $Env:TEMP\libxxhash-0.8.1-1-x86_64.pkg.tar -C "C:\LibXXHash"
|
|
|
|
|
|
|
|
# Install libzstd 1.5.4 needed for rsync 3.2.7.
|
|
|
|
RUN powershell Invoke-WebRequest -Uri https://repo.msys2.org/msys/x86_64/libzstd-1.5.4-1-x86_64.pkg.tar.zst -OutFile $Env:TEMP\libzstd-1.5.4-1-x86_64.pkg.tar.zst
|
|
|
|
RUN powershell zstd -d $Env:TEMP\libzstd-1.5.4-1-x86_64.pkg.tar.zst -o $Env:TEMP\libzstd-1.5.4-1-x86_64.pkg.tar
|
|
|
|
RUN powershell mkdir "C:\LibZStd"
|
|
|
|
RUN powershell tar -xvf $Env:TEMP\libzstd-1.5.4-1-x86_64.pkg.tar -C "C:\LibZStd"
|
|
|
|
|
|
|
|
# Install rsync 3.2.7.
|
|
|
|
RUN powershell Invoke-WebRequest -Uri https://repo.msys2.org/msys/x86_64/rsync-3.2.7-2-x86_64.pkg.tar.zst -OutFile $Env:TEMP\rsync-3.2.7-2-x86_64.pkg.tar.zst
|
|
|
|
RUN powershell zstd -d $Env:TEMP\rsync-3.2.7-2-x86_64.pkg.tar.zst -o $Env:TEMP\rsync-3.2.7-2-x86_64.pkg.tar
|
|
|
|
RUN powershell mkdir "C:\RSync"
|
|
|
|
RUN powershell tar -xvf $Env:TEMP\rsync-3.2.7-2-x86_64.pkg.tar -C "C:\RSync"
|
|
|
|
# Copy the dependencies of rsync 3.2.7.
|
|
|
|
RUN powershell Copy-Item -Path "C:\LibOpenSSL\usr\bin\*.dll" -Destination "C:\Program` Files\Git\usr\bin"
|
|
|
|
RUN powershell Copy-Item -Path "C:\LibXXHash\usr\bin\*.dll" -Destination "C:\Program` Files\Git\usr\bin"
|
|
|
|
RUN powershell Copy-Item -Path "C:\LibZStd\usr\bin\*.dll" -Destination "C:\Program` Files\Git\usr\bin"
|
|
|
|
RUN powershell Copy-Item -Path "C:\RSync\usr\bin\*" -Destination "C:\Program` Files\Git\usr\bin"
|
|
|
|
|
2024-04-09 16:45:05 +00:00
|
|
|
COPY pkg-resolver pkg-resolver
|
|
|
|
|
|
|
|
## Install Python 3.11.8.
|
|
|
|
# The Python installation steps below are derived from -
|
|
|
|
# https://github.com/docker-library/python/blob/105d6f34e7d70aad6f8c3e249b8208efa591916a/3.11/windows/windowsservercore-ltsc2022/Dockerfile
|
|
|
|
ENV PYTHONIOENCODING UTF-8
|
|
|
|
ENV PYTHON_VERSION 3.11.8
|
|
|
|
ENV PYTHON_PIP_VERSION 24.0
|
|
|
|
ENV PYTHON_SETUPTOOLS_VERSION 65.5.1
|
|
|
|
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/dbf0c85f76fb6e1ab42aa672ffca6f0a675d9ee4/public/get-pip.py
|
|
|
|
ENV PYTHON_GET_PIP_SHA256 dfe9fd5c28dc98b5ac17979a953ea550cec37ae1b47a5116007395bfacff2ab9
|
|
|
|
RUN powershell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
|
|
RUN powershell pkg-resolver\install-python.ps1
|
|
|
|
RUN powershell pkg-resolver\install-pip.ps1
|
|
|
|
RUN powershell pip install python-dateutil
|
2023-11-01 16:10:15 +00:00
|
|
|
|
|
|
|
# Create a user HadoopBuilder with basic privileges and use it for building Hadoop on Windows.
|
|
|
|
RUN powershell New-LocalUser -Name 'HadoopBuilder' -Description 'User account for building Apache Hadoop' -Password ([securestring]::new()) -AccountNeverExpires -PasswordNeverExpires
|
|
|
|
|
|
|
|
# Grant the privilege to create symbolic links to HadoopBuilder.
|
|
|
|
RUN powershell secedit /export /cfg "C:\secpol.cfg"
|
|
|
|
RUN powershell "(Get-Content C:\secpol.cfg).Replace('SeCreateSymbolicLinkPrivilege = ', 'SeCreateSymbolicLinkPrivilege = HadoopBuilder,') | Out-File C:\secpol.cfg"
|
|
|
|
RUN powershell secedit /configure /db "C:\windows\security\local.sdb" /cfg "C:\secpol.cfg"
|
|
|
|
RUN powershell Remove-Item -Force "C:\secpol.cfg" -Confirm:$false
|
|
|
|
|
|
|
|
# Login as HadoopBuilder and set the necessary environment and PATH variables.
|
|
|
|
USER HadoopBuilder
|
|
|
|
ENV PROTOBUF_HOME "C:\vcpkg\installed\x64-windows"
|
|
|
|
ENV JAVA_HOME "C:\Java\zulu8.62.0.19-ca-jdk8.0.332-win_x64"
|
|
|
|
ENV MAVEN_OPTS '-Xmx2048M -Xss128M'
|
2024-04-09 16:45:05 +00:00
|
|
|
ENV IS_WINDOWS 1
|
2023-11-01 16:10:15 +00:00
|
|
|
RUN setx PATH "%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
|
|
|
|
RUN setx PATH "%PATH%;%JAVA_HOME%\bin"
|
|
|
|
RUN setx PATH "%PATH%;C:\Maven\apache-maven-3.8.6\bin"
|
|
|
|
RUN setx PATH "%PATH%;C:\CMake\cmake-3.19.0-win64-x64\bin"
|
|
|
|
RUN setx PATH "%PATH%;C:\ZStd"
|
|
|
|
RUN setx PATH "%PATH%;C:\Program Files\Git\usr\bin"
|
2023-05-21 15:40:04 +00:00
|
|
|
|
2022-10-12 16:30:54 +00:00
|
|
|
# We get strange Javadoc errors without this.
|
|
|
|
RUN setx classpath ""
|
|
|
|
|
2023-11-01 16:10:15 +00:00
|
|
|
# Setting Git configurations.
|
|
|
|
RUN git config --global core.autocrlf true
|
2023-05-03 17:14:54 +00:00
|
|
|
RUN git config --global core.longpaths true
|
|
|
|
|
2022-10-12 16:30:54 +00:00
|
|
|
# Define the entry point for the docker container.
|
|
|
|
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&", "cmd.exe"]
|