Skip to content

Commit

Permalink
VLCLJ-2185 Add windows and linux dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
lisanna-dettwyler authored and bmyates committed May 1, 2024
1 parent bdce874 commit 124a64f
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/docker/rhel.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# syntax=docker/dockerfile:1.4

ARG VMAJ
ARG VMIN
FROM ghcr.io/oneapi-src/level-zero-linux-compute/rhel:${VMAJ}.${VMIN}
25 changes: 25 additions & 0 deletions .github/docker/sles.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1.4

ARG VMAJ
ARG VMIN
FROM ghcr.io/oneapi-src/level-zero-linux-compute/sles:${VMAJ}.${VMIN}

SHELL ["/bin/bash", "-e", "-c"]

# Static libraries for boost are not part of the SLES distribution
RUN <<EOF
git clone --recurse-submodules --branch boost-1.70.0 https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh
./b2 install \
-j 4 \
address-model=64 \
--with-chrono \
--with-log \
--with-program_options \
--with-serialization \
--with-system \
--with-timer
cd ..
rm -rf boost
EOF
116 changes: 116 additions & 0 deletions .github/docker/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# syntax=docker/dockerfile:1.4

ARG VMAJ
ARG VMIN
FROM ghcr.io/oneapi-src/level-zero-linux-compute/ubuntu:${VMAJ}.${VMIN}

ARG VMAJ
ARG VMIN

SHELL ["/bin/bash", "-e", "-c"]

RUN <<EOF
sed -i 's/^deb/deb [arch=amd64]/' /etc/apt/sources.list
source /etc/lsb-release
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DISTRIB_CODENAME} main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DISTRIB_CODENAME}-updates main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DISTRIB_CODENAME}-security main restricted universe multiverse" >> /etc/apt/sources.list
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ ${DISTRIB_CODENAME}-backports main restricted universe multiverse" >> /etc/apt/sources.list
dpkg --add-architecture arm64
EOF

ENV DEBIAN_FRONTEND=noninteractive
# /etc/apt/apt.conf.d/docker-clean doesn't work on older versions of docker for U2204 containers
RUN --mount=type=cache,target=/var/cache/apt <<EOF
rm /etc/apt/apt.conf.d/docker-clean
apt-get update
apt-get install -o Dpkg::Options::="--force-overwrite" -y \
build-essential \
ccache \
$(((VMAJ == 20)) && echo \
clang-format-7) \
clang-tidy \
cmake \
curl \
file \
git \
ninja-build \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
$(((VMAJ >= 20)) && echo \
gcc-10-aarch64-linux-gnu \
g++-10-aarch64-linux-gnu) \
libc6:arm64 \
libstdc++6:arm64 \
libpapi-dev \
libpapi-dev:arm64 \
libpng-dev \
libpng-dev:arm64 \
libva-dev \
libva-dev:arm64 \
ocl-icd-opencl-dev \
ocl-icd-opencl-dev:arm64 \
opencl-headers \
python3 \
python3-pip
rm -rf /var/lib/apt/lists/*
EOF

# Make newest version of aarch64 toolchain the default and enable switching.
RUN <<EOF
shopt -s extglob
for tool in $(ls /usr/bin/aarch64-linux-gnu-*([a-z\-+])); do
for v in $(ls /usr/bin/aarch64-linux-gnu-* | grep -o [0-9]*$ | sort | uniq); do
if [[ -f ${tool}-${v} ]]; then
update-alternatives --install ${tool} $(basename ${tool}) ${tool}-${v} ${v}
fi
done
done
EOF

# Static libraries for boost cannot be installed from the apt sources
# without conflicts
# Required for https://github.com/boostorg/thread/issues/364 on Ubuntu 22+
ENV BOOST_BUILD_PATH=/boost_1_73_0
ADD https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz /boost_1_73_0.tar.gz
RUN <<EOF
tar xf /boost_1_73_0.tar.gz
rm /boost_1_73_0.tar.gz
cd /boost_1_73_0
./bootstrap.sh
./b2 install \
-j $(nproc) \
link=static \
address-model=64 \
--with-chrono \
--with-log \
--with-program_options \
--with-regex \
--with-serialization \
--with-system \
--with-timer
EOF
COPY <<EOF /boost_1_73_0/config.jam
using gcc : arm : aarch64-linux-gnu-g++ ;
EOF
RUN <<EOF
cd /boost_1_73_0
rm ./b2
./bootstrap.sh --libdir=/usr/local/lib/aarch64-linux-gnu
./b2 install \
--config=/boost_1_73_0/config.jam \
-j $(nproc) \
link=static \
address-model=64 \
--libdir=/usr/local/lib/aarch64-linux-gnu \
toolset=gcc-arm \
--with-chrono \
--with-log \
--with-program_options \
--with-regex \
--with-serialization \
--with-system \
--with-timer
cd ..
rm -rf /boost_1_73_0
EOF
107 changes: 107 additions & 0 deletions .github/docker/windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# escape=`

ARG BASE_IMAGE=mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019
FROM ${BASE_IMAGE}

SHELL ["powershell"]
RUN New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
ENV VS_VERSION=2019
RUN [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
Switch ($env:VS_VERSION) { `
"2019" {$url_version = "16"} `
"2022" {$url_version = "17"} `
default {echo "Unsupported VS version $env:VS_VERSION"; EXIT 1} `
}; `
wget -Uri https://aka.ms/vs/${url_version}/release/vs_buildtools.exe -OutFile vs_buildtools.exe
SHELL ["cmd", "/S", "/C"]
RUN (start /w vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_VERSION%\BuildTools" `
--add Microsoft.Component.MSBuild `
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools `
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest `
--add Microsoft.VisualStudio.Component.Windows10SDK `
--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core `
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 `
--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0) `
&& del /q vs_buildtools.exe `
&& mklink /d "C:\Program Files (x86)\Microsoft Visual Studio\current" "C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%" `
&& if not exist "C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\BuildTools\Common7\Tools\VsDevCmd.bat" exit 1
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\current\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat", "&&"]

SHELL ["powershell"]
ENV chocolateyUseWindowsCompression false
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
SHELL ["cmd", "/S", "/C"]
RUN call "%ProgramFiles(x86)%\Microsoft Visual Studio\current\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && `
powershell -command "[Environment]::SetEnvironmentVariable('Path', $env:Path, [System.EnvironmentVariableTarget]::Machine)"
RUN choco feature disable --name showDownloadProgress && `
choco install -y --fail-on-error-output git -params '"/GitAndUnixToolsOnPath"' && `
choco install -y --fail-on-error-output 7zip && `
choco install -y --fail-on-error-output ccache && `
choco install -y --fail-on-error-output cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' && `
choco install -y --fail-on-error-output ninja

SHELL ["bash.exe", "-x", "-e", "-c"]

RUN "`
curl -OSL --ssl-no-revoke https://zlib.net/zlib131.zip && `
7z.exe x zlib131.zip && `
rm zlib131.zip && `
cd zlib-1.3.1 && `
mkdir build && `
cd build && `
cmake.exe .. -A x64 -T host=x64 -D BUILD_SHARED_LIBS=YES && `
cmake.exe --build . --target INSTALL --config Release && `
cd ../.. && `
rm -rf zlib-1.3.1"

RUN "`
curl -OSL --ssl-no-revoke https://download.sourceforge.net/libpng/lpng1639.zip && `
7z.exe x lpng1639.zip && `
rm lpng1639.zip && `
mkdir -p lpng1639/build && `
cd lpng1639/build && `
cmake .. -T host=x64 -A x64 && `
cmake --build . --target INSTALL --config Release && `
cd ../.. && `
rm -rf lpng1639"

RUN "`
curl -SL --ssl-no-revoke https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2022.09.30.zip -o OpenCL-Headers.zip && `
7z.exe x OpenCL-Headers.zip && `
rm OpenCL-Headers.zip && `
mkdir OpenCL-Headers-2022.09.30/build && `
cd OpenCL-Headers-2022.09.30/build && `
cmake .. && `
cmake --build . --target install && `
cd ../.. && `
rm -rf OpenCL-Headers-2022.09.30"
RUN "`
curl -SL --ssl-no-revoke https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2022.09.30.zip -o OpenCL-ICD-Loader.zip && `
7z.exe x OpenCL-ICD-Loader.zip && `
rm OpenCL-ICD-Loader.zip && `
mkdir OpenCL-ICD-Loader-2022.09.30/build && `
cd OpenCL-ICD-Loader-2022.09.30/build && `
cmake .. -T host=x64 -A x64 && `
cmake --build . --target install && `
cd ../.. && `
rm -rf OpenCL-ICD-Loader-2022.09.30"

RUN "`
curl -OSL --ssl-no-revoke https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.7z && `
7z.exe x boost_1_73_0.7z && `
cd boost_1_73_0 && `
MSYS_NO_PATHCONV=1 cmd /c bootstrap.bat && `
./b2.exe install -j 16 address-model=64 `
--with-chrono `
--with-log `
--with-program_options `
--with-serialization `
--with-system `
--with-timer && `
cd .. && `
rm -rf boost_1_73_0"

0 comments on commit 124a64f

Please sign in to comment.