110 lines · plain
1FROM docker.io/library/ubuntu:24.04 AS base2ENV LLVM_SYSROOT=/opt/llvm3 4FROM base AS stage1-toolchain5ENV LLVM_VERSION=21.1.36 7RUN apt-get update && \8 apt-get install -y \9 wget \10 gcc \11 g++ \12 cmake \13 ninja-build \14 python3 \15 git \16 curl \17 zlib1g-dev && \18 apt-get clean && \19 rm -rf /var/lib/apt/lists/*20 21RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && \22 tar -xf llvmorg-$LLVM_VERSION.tar.gz && \23 rm -f llvmorg-$LLVM_VERSION.tar.gz24 25WORKDIR /llvm-project-llvmorg-$LLVM_VERSION26 27RUN cmake -B ./build -G Ninja ./llvm \28 -C ./clang/cmake/caches/BOLT-PGO.cmake \29 -DBOOTSTRAP_LLVM_ENABLE_LLD=ON \30 -DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \31 -DPGO_INSTRUMENT_LTO=Thin \32 -DLLVM_ENABLE_RUNTIMES="compiler-rt" \33 -DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \34 -DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \35 -DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format;scan-build;llvm-symbolizer" \36 -DCLANG_DEFAULT_LINKER="lld"37 38RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution39 40FROM base AS ci-container41 42COPY --from=stage1-toolchain $LLVM_SYSROOT $LLVM_SYSROOT43 44# Need to install curl for hendrikmuhs/ccache-action45# Need nodejs for some of the GitHub actions.46# Need perl-modules for clang analyzer tests.47# Need git for SPIRV-Tools tests.48RUN apt-get update && \49 DEBIAN_FRONTEND=noninteractive apt-get install -y \50 binutils \51 cmake \52 curl \53 git \54 libstdc++-11-dev \55 ninja-build \56 nodejs \57 perl-modules \58 python3-psutil \59 sudo \60 # These are needed by the premerge pipeline. Pip is used to install61 # dependent python packages. File and tzdata are used for tests.62 # Having a symlink from python to python3 enables code sharing between63 # the Linux and Windows pipelines.64 python3-pip \65 file \66 tzdata \67 python-is-python3 && \68 apt-get clean && \69 rm -rf /var/lib/apt/lists/*70 71# We need sccache for caching. We cannot use the apt repository version because72# it is too old and has bugs related to features we require (particularly GCS73# caching), so we manually install it here.74# TODO(boomanaiden154): We should return to installing this from the apt75# repository once a version containing the necessary bug fixes is available.76RUN curl -L "https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-$(arch)-unknown-linux-musl.tar.gz" > /tmp/sccache.tar.gz && \77 echo $( [ $(arch) = 'x86_64' ] && echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b" || echo "d6a1ce4acd02b937cd61bc675a8be029a60f7bc167594c33d75732bbc0a07400") /tmp/sccache.tar.gz | sha256sum -c && \78 tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \79 rm /tmp/sccache.tar.gz && \80 chmod +x /usr/local/bin/sccache81 82ENV LLVM_SYSROOT=$LLVM_SYSROOT83ENV PATH=${LLVM_SYSROOT}/bin:${PATH}84ENV CC=clang85ENV CXX=clang++86 87# Create a new user to avoid test failures related to a lack of expected88# permissions issues in some tests. Set the user id to 1001 as that is the89# user id that Github Actions uses to perform the checkout action.90RUN useradd gha -u 1001 -m -s /bin/bash91 92# Also add the user to passwordless sudoers so that we can install software93# later on without having to rebuild the container.94RUN adduser gha sudo95RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers96 97USER gha98WORKDIR /home/gha99 100FROM ci-container AS ci-container-agent101 102ENV GITHUB_RUNNER_VERSION=2.330.0103 104RUN mkdir actions-runner && \105 cd actions-runner && \106 curl -O -L https://github.com/actions/runner/releases/download/v$GITHUB_RUNNER_VERSION/actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \107 tar xzf ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \108 rm ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz109 110