Skip to content

Commit

Permalink
Fill out matrix of Azure Linux images for net8.0 (#1261)
Browse files Browse the repository at this point in the history
Adds Azure Linux variants of images used in the .NET 8 build.
  • Loading branch information
sbomer authored Nov 25, 2024
1 parent ecafe28 commit f4cbcaf
Show file tree
Hide file tree
Showing 16 changed files with 370 additions and 14 deletions.
59 changes: 59 additions & 0 deletions src/azurelinux/3.0/net8.0/android/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
ARG ANDROID_SDK_ROOT=/usr/local/android-sdk
ARG ANDROID_NDK_VERSION=23.2.8568313
ARG ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION
FROM mcr.microsoft.com/openjdk/jdk:17-mariner AS android-sdk-download
ARG ANDROID_SDK_ROOT
ARG ANDROID_NDK_VERSION
ARG ANDROID_NDK_ROOT

# Dependencies for Android SDK install
RUN tdnf update -y \
&& tdnf install -y \
# Android dependencies
wget \
zip \
unzip

# Grab the necessary Android SDK packages / tools
RUN wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \
&& echo "2d2d50857e4eb553af5a6dc3ad507a17adf43d115264b1afc116f95c92e5e258 commandlinetools-linux-11076708_latest.zip" | sha256sum -c \
&& mkdir -p /usr/local/cmdline-tools \
&& unzip commandlinetools-linux-11076708_latest.zip -d /usr/local/cmdline-tools \
&& rm -f commandlinetools-linux-11076708_latest.zip \
&& yes | /usr/local/cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" --licenses

RUN yes | /usr/local/cmdline-tools/cmdline-tools/bin/sdkmanager --licenses
RUN /usr/local/cmdline-tools/cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_SDK_ROOT}" --install "build-tools;33.0.0" "platforms;android-33" "ndk;${ANDROID_NDK_VERSION}"

# We can't upgrade the NDK version as the runtime repo requires tooling that only exists up to NDK 23
# Remove all components of NDK 23 that are flagged by security scanners
RUN rm -r ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/python3/lib/python3.9/site-packages/ \
&& rm -r ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-tidy

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-llvm-amd64

# Install Microsoft OpenJDK from the Microsoft OpenJDK 17 Mariner image.
ENV LANG=en_US.UTF-8
ENV JAVA_HOME=/usr/lib/jvm/msopenjdk-17
ENV PATH=$JAVA_HOME/bin:$PATH
COPY --from=mcr.microsoft.com/openjdk/jdk:17-mariner $JAVA_HOME $JAVA_HOME
ARG ANDROID_SDK_ROOT
ARG ANDROID_NDK_VERSION
ARG ANDROID_NDK_ROOT


# Dependencies for Android build
RUN tdnf update -y \
&& tdnf install -y \
# Common dependencies
binutils \
# Android dependencies
zip \
unzip \
# linux-bionic build dependencies
openssl-devel

ENV ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}
ENV ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}

COPY --from=android-sdk-download $ANDROID_SDK_ROOT $ANDROID_SDK_ROOT
6 changes: 6 additions & 0 deletions src/azurelinux/3.0/net8.0/android/docker/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-android-amd64

RUN tdnf update -y \
&& tdnf install -y \
moby-engine \
moby-cli
6 changes: 6 additions & 0 deletions src/azurelinux/3.0/net8.0/cross/android/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-cross-amd64 AS crossrootx64

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-android-amd64

# Copy crossrootfs from AMD64 build image, so we can build Android-targeting code for that arch
COPY --from=crossrootx64 /crossrootfs/x64 /crossrootfs/x64
19 changes: 19 additions & 0 deletions src/azurelinux/3.0/net8.0/cross/freebsd/13/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG ROOTFS_DIR=/crossrootfs/x64

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-builder-amd64 AS builder
ARG ROOTFS_DIR

# Install packages needed by the FreeBSD bootstrap scripts
RUN tdnf install -y \
awk \
m4 && \
# The xz package in Azure Linux 3.0 doesn't provide liblzma.so, so we need to create a symlink to liblzma.so.5
# so the FreeBSD bootstrap can find it. See https://github.com/microsoft/azurelinux/issues/9217
ln -s /usr/lib/liblzma.so.5 /usr/lib/liblzma.so

RUN /scripts/eng/common/cross/build-rootfs.sh freebsd13 x64

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-llvm-amd64
ARG ROOTFS_DIR

COPY --from=builder "$ROOTFS_DIR" "$ROOTFS_DIR"
11 changes: 11 additions & 0 deletions src/azurelinux/3.0/net8.0/cross/ppc64le/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG ROOTFS_DIR=/crossrootfs/ppc64le

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-builder-amd64 AS builder
ARG ROOTFS_DIR

RUN /scripts/eng/common/cross/build-rootfs.sh bionic ppc64le

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-llvm-amd64
ARG ROOTFS_DIR

COPY --from=builder "$ROOTFS_DIR" "$ROOTFS_DIR"
54 changes: 54 additions & 0 deletions src/azurelinux/3.0/net8.0/cross/riscv64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ARG ROOTFS_DIR=/crossrootfs/riscv64

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-builder-amd64 AS builder
ARG ROOTFS_DIR

# Install the latest debootstrap
RUN tdnf remove -y debootstrap && \
curl -fsL -o debootstrap.tar.gz https://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.137.tar.gz && \
echo "666927457ee4b0b3e68e55a0efbf3fb69189610b7abbd534017d7032cb3ae833 debootstrap.tar.gz" | sha256sum -c - && \
tar xzf debootstrap.tar.gz -C / && \
ln -s /debootstrap/debootstrap -t /usr/local/bin && \
rm -f debootstrap.tar.gz

RUN /scripts/eng/common/cross/build-rootfs.sh riscv64 noble --skipunmount

RUN TARGET_TRIPLE="riscv64-linux-gnu" && \
CLANG_MAJOR_VERSION=$(clang --version | grep -oP "(?<=version )\d+") && \
cmake -S llvm-project.src/runtimes -B runtimes \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_ASM_COMPILER=clang \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_ASM_COMPILER_TARGET="$TARGET_TRIPLE" \
-DCMAKE_C_COMPILER_TARGET="$TARGET_TRIPLE" \
-DCMAKE_CXX_COMPILER_TARGET="$TARGET_TRIPLE" \
# We're going to link the static libraries we build here into PIC images, so build the static libraries as PIC.
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_SYSROOT="$ROOTFS_DIR" \
# Specify linker to use for exes directly for CMake toolchain detection
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
# Don't search for tools in the sysroot as we're cross-compiling
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="NEVER" \
-DLLVM_USE_LINKER=lld \
-DLLVM_ENABLE_RUNTIMES="libcxx;compiler-rt" \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXX_CXX_ABI=libstdc++ \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS="$ROOTFS_DIR/usr/include/c++/13/;$ROOTFS_DIR/usr/include/$TARGET_TRIPLE" \
-DCOMPILER_RT_CXX_LIBRARY="libcxx" \
-DCOMPILER_RT_STATIC_CXX_LIBRARY=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=OFF \
-DCOMPILER_RT_BUILD_MEMPROF=OFF \
# The libfuzzer build in LLVM doesn't correctly forward the required CMake properties to the "fuzzed libc++" build
# so skip it here.
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
-DCOMPILER_RT_INSTALL_PATH="/usr/local/lib/clang/$CLANG_MAJOR_VERSION" && \
cmake --build runtimes -j $(getconf _NPROCESSORS_ONLN) && \
cmake --install runtimes --prefix "$ROOTFS_DIR/usr"

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-llvm-amd64
ARG ROOTFS_DIR

COPY --from=builder /usr/local/lib/clang /usr/local/lib/clang/
COPY --from=builder $ROOTFS_DIR $ROOTFS_DIR
24 changes: 24 additions & 0 deletions src/azurelinux/3.0/net8.0/cross/s390x/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG ROOTFS_DIR=/crossrootfs/s390x

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-builder-amd64 AS builder
ARG ROOTFS_DIR

RUN /scripts/eng/common/cross/build-rootfs.sh bionic s390x

# build ld from binutils since llvm's lld only supports s390x since 18.0 but we're using 16.0
# this can be removed once crossdeps-builder switches to llvm 18.0
RUN tdnf install -y awk && \
wget https://sourceware.org/pub/binutils/snapshots/binutils-2.41.90.tar.xz -O binutils.tar.xz && \
echo "6e990c6e40000acedb9928fa6b6a32a164f3119740a95c40e7a85c6461dbdda5 binutils.tar.xz" | sha256sum -c && \
mkdir binutils.src && \
tar -xf binutils.tar.xz --directory=binutils.src --strip-components=1 && \
cd binutils.src && \
./configure --target=s390x-linux-gnu --prefix=/binutils.install --disable-nls --disable-werror && \
make -j $(getconf _NPROCESSORS_ONLN) && \
make install -C ld

FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-crossdeps-llvm-amd64
ARG ROOTFS_DIR

COPY --from=builder "$ROOTFS_DIR" "$ROOTFS_DIR"
COPY --from=builder /binutils.install/s390x-linux-gnu/bin/ld /usr/local/bin/s390x-linux-gnu-ld
15 changes: 8 additions & 7 deletions src/azurelinux/3.0/net8.0/crossdeps-builder/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ COPY dimitri_john_ledkov.asc .
RUN gpg --import dimitri_john_ledkov.asc && \
rm dimitri_john_ledkov.asc && \
# 2. Download the ubuntu keyrings
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/u/ubuntu-keyring/ubuntu-keyring_2021.03.26.tar.gz && \
echo "492eed5c06408c6f632577adb0796130af5d6542013ef418f47187a209e49bb1 ubuntu-keyring_2021.03.26.tar.gz" | sha256sum -c && \
tar xf ubuntu-keyring_2021.03.26.tar.gz && \
rm ubuntu-keyring_2021.03.26.tar.gz && \
wget https://mirrors.edge.kernel.org/ubuntu/pool/main/u/ubuntu-keyring/ubuntu-keyring_2023.11.28.1.tar.xz && \
echo "aecd455ae15561371d6e454f121f079f0641d5e1b579a5563a2bc363fc74aa2e ubuntu-keyring_2023.11.28.1.tar.xz" | sha256sum -c && \
tar xf ubuntu-keyring_2023.11.28.1.tar.xz && \
rm ubuntu-keyring_2023.11.28.1.tar.xz && \
# 3. Verify keyrings
pushd ubuntu-keyring-2021.03.26 && \
pushd ubuntu-keyring && \
gpg --output SHA512SUMS.txt --decrypt SHA512SUMS.txt.asc && \
sha512sum -c SHA512SUMS.txt && \
# 4. Install the needed keyring and delete the rest
mkdir -p /usr/share/keyrings && \
mv keyrings/ubuntu-archive-keyring.gpg /usr/share/keyrings && \
wget -qO- "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C" | gpg --dearmor > /usr/share/keyrings/ubuntu-archive-removed-keys.gpg && \
popd && \
rm -r ubuntu-keyring-2021.03.26
rm -r ubuntu-keyring

# 1. Obtain signing keys used to sign llvm sources
RUN wget https://releases.llvm.org/release-keys.asc && \
Expand All @@ -72,7 +73,7 @@ RUN mkdir llvm-project.src && \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;PowerPC;SystemZ" \
-DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;PowerPC;RISCV;SystemZ" \
-Wno-dev \
-DLLVM_ENABLE_PROJECTS="clang;lld;clang-tools-extra" && \
make -j $(getconf _NPROCESSORS_ONLN) && \
Expand Down
2 changes: 1 addition & 1 deletion src/azurelinux/3.0/net8.0/crossdeps/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM mcr.microsoft.com/azurelinux/base/core:3.0

RUN tdnf update -y && \
tdnf install -y \
# Provides 'su', required by Azure DevOps
ca-certificates \
git \
# Provides 'su', required by Azure DevOps
util-linux \
wget \
# Common runtime build dependencies
Expand Down
18 changes: 18 additions & 0 deletions src/azurelinux/3.0/net8.0/fpm/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/azurelinux/base/core:3.0
RUN tdnf install -y \
awk \
build-essential \
ca-certificates \
git \
icu \
rpm-build \
ruby \
# Provides useradd
shadow-utils \
tar \
# Provides su
util-linux \
# Provides sudo
sudo \
&& tdnf clean all \
&& gem install fpm
49 changes: 49 additions & 0 deletions src/azurelinux/3.0/net8.0/webassembly/amd64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net8.0-cross-amd64

# Dependencies for WebAssembly build
RUN tdnf update -y \
&& tdnf install -y \
# WebAssembly build dependencies
which \
nodejs \
npm \
python3 \
libxml2 \
unzip

# WebAssembly build needs typescript
RUN npm i -g typescript

# Install V8 Engine
SHELL ["/bin/bash", "-c"]

ENV V8_VERSION=10.8.168
RUN curl -sSL https://netcorenativeassets.blob.core.windows.net/resource-packages/external/linux/chromium-v8/v8-linux64-rel-${V8_VERSION}.zip -o ./v8.zip \
&& unzip ./v8.zip -d /usr/local/v8 \
&& echo $'#!/usr/bin/env bash\n\
"/usr/local/v8/d8" --snapshot_blob="/usr/local/v8/snapshot_blob.bin" "$@"\n' > /usr/local/bin/v8 \
&& chmod +x /usr/local/bin/v8

# Install Wasi toolchain
ENV WASI_SDK_VERSION=22
ENV WASI_SDK_PATH=/usr/local/wasi-sdk
ENV WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VERSION}/wasi-sdk-${WASI_SDK_VERSION}.0-linux.tar.gz

RUN mkdir -p ${WASI_SDK_PATH} \
&& cd /tmp \
&& curl -L -o /tmp/wasi-sdk.tar.gz ${WASI_SDK_URL} \
&& tar --strip-components=1 -xvzf /tmp/wasi-sdk.tar.gz -C ${WASI_SDK_PATH} \
&& echo ${WASI_SDK_VERSION} > ${WASI_SDK_PATH}/wasi-sdk-version.txt \
&& rm /tmp/wasi-sdk.tar.gz

ENV WASMTIME_VERSION=19.0.2
ENV WASMTIME_PATH=/usr/local/wasmtime
ENV WASMTIME_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v${WASMTIME_VERSION}/wasmtime-v${WASMTIME_VERSION}-x86_64-linux.tar.xz

RUN mkdir -p ${WASMTIME_PATH} \
&& cd /tmp \
&& curl -L -o /tmp/wasmtime.tar.xz ${WASMTIME_URL} \
&& tar --strip-components=1 -xvf /tmp/wasmtime.tar.xz -C ${WASMTIME_PATH} \
&& echo ${WASMTIME_VERSION} > ${WASMTIME_PATH}/wasmtime-version.txt \
&& rm /tmp/wasmtime.tar.xz \
&& ln -s ${WASMTIME_PATH}/wasmtime /bin/wasmtime
2 changes: 1 addition & 1 deletion src/azurelinux/3.0/net9.0/android/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG ANDROID_SDK_ROOT
ARG ANDROID_NDK_VERSION
ARG ANDROID_NDK_ROOT

# Dependencies for Android build
# Dependencies for Android SDK install
RUN tdnf update -y \
&& tdnf install -y \
# Android dependencies
Expand Down
2 changes: 1 addition & 1 deletion src/azurelinux/3.0/net9.0/crossdeps/amd64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM mcr.microsoft.com/azurelinux/base/core:3.0

RUN tdnf update -y && \
tdnf install -y \
# Provides 'su', required by Azure DevOps
ca-certificates \
git \
pigz \
# Provides 'su', required by Azure DevOps
util-linux \
wget \
# Common runtime build dependencies
Expand Down
Loading

0 comments on commit f4cbcaf

Please sign in to comment.