1 1.1 joerg #===----------------------------------------------------------------------===## 2 1.1 joerg # 3 1.1 joerg # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 1.1 joerg # See https://llvm.org/LICENSE.txt for license information. 5 1.1 joerg # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 1.1 joerg # 7 1.1 joerg #===----------------------------------------------------------------------===## 8 1.1 joerg 9 1.1 joerg # 10 1.1 joerg # This Dockerfile describes the base image used to run the various libc++ 11 1.1 joerg # build bots. By default, the image runs the Buildkite Agent, however one 12 1.1 joerg # can also just start the image with a shell to debug CI failures. 13 1.1 joerg # 14 1.1 joerg # To start a Buildkite Agent, run it as: 15 1.1 joerg # $ docker run --env-file secrets.env -it $(docker build -q .) 16 1.1 joerg # 17 1.1 joerg # The environment variables in `secrets.env` must be replaced by the actual 18 1.1 joerg # tokens for this to work. These should obviously never be checked in. 19 1.1 joerg # 20 1.1 joerg # If you're only looking to run the Docker image locally for debugging a 21 1.1 joerg # build bot, see the `run-buildbot-container` script located in this directory. 22 1.1 joerg # 23 1.1 joerg # A pre-built version of this image is maintained on DockerHub as ldionne/libcxx-builder. 24 1.1 joerg # To update the image, rebuild it and push it to ldionne/libcxx-builder (which 25 1.1 joerg # will obviously only work if you have permission to do so). 26 1.1 joerg # 27 1.1 joerg # $ docker build -t ldionne/libcxx-builder . 28 1.1 joerg # $ docker push ldionne/libcxx-builder 29 1.1 joerg # 30 1.1 joerg 31 1.1 joerg FROM ubuntu:bionic 32 1.1 joerg 33 1.1 joerg # Make sure apt-get doesn't try to prompt for stuff like our time zone, etc. 34 1.1 joerg ENV DEBIAN_FRONTEND=noninteractive 35 1.1 joerg 36 1.1 joerg RUN apt-get update && apt-get install -y bash curl 37 1.1 joerg 38 1.1 joerg # Install various tools used by the build or the test suite 39 1.1 joerg RUN apt-get update && apt-get install -y ninja-build python3 python3-sphinx python3-distutils git gdb 40 1.1 joerg RUN apt-get update && apt-get install -y libc6-dev-i386 # Required to cross-compile to 32 bits 41 1.1 joerg 42 1.1 joerg # Install the most recently released LLVM 43 1.1 joerg RUN apt-get update && apt-get install -y lsb-release wget software-properties-common 44 1.1 joerg RUN wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh 45 1.1 joerg RUN bash /tmp/llvm.sh 46 1.1 joerg RUN LLVM_VERSION=$(find /usr/bin -regex '^.+/clang-[0-9.]+$') && LLVM_VERSION=${LLVM_VERSION#*clang-} && echo "LLVM_VERSION=$LLVM_VERSION" > /tmp/env.sh 47 1.1 joerg RUN ln -s $(find /usr/bin -regex '^.+/clang\+\+-[0-9.]+$') /usr/bin/clang++ && [ -e $(readlink /usr/bin/clang++) ] 48 1.1 joerg RUN ln -s $(find /usr/bin -regex '^.+/clang-[0-9.]+$') /usr/bin/clang && [ -e $(readlink /usr/bin/clang) ] 49 1.1 joerg 50 1.1 joerg # Install the not-yet-released LLVM 51 1.1 joerg RUN . /tmp/env.sh && echo "LLVM_TOT_VERSION=$(($LLVM_VERSION + 1))" >> /tmp/env.sh 52 1.1 joerg RUN . /tmp/env.sh && bash /tmp/llvm.sh ${LLVM_TOT_VERSION} 53 1.1 joerg RUN . /tmp/env.sh && ln -s /usr/bin/clang++-${LLVM_TOT_VERSION} /usr/bin/clang++-tot && [ -e $(readlink /usr/bin/clang++-tot) ] 54 1.1 joerg RUN . /tmp/env.sh && ln -s /usr/bin/clang-${LLVM_TOT_VERSION} /usr/bin/clang-tot && [ -e $(readlink /usr/bin/clang-tot) ] 55 1.1 joerg 56 1.1 joerg # Install clang-format 57 1.1 joerg RUN . /tmp/env.sh && apt-get install -y clang-format-$LLVM_VERSION 58 1.1 joerg RUN ln -s $(find /usr/bin -regex '^.+/clang-format-[0-9.]+$') /usr/bin/clang-format && [ -e $(readlink /usr/bin/clang-format) ] 59 1.1 joerg RUN ln -s $(find /usr/bin -regex '^.+/git-clang-format-[0-9.]+$') /usr/bin/git-clang-format && [ -e $(readlink /usr/bin/git-clang-format) ] 60 1.1 joerg 61 1.1 joerg # Install a recent GCC 62 1.1 joerg RUN add-apt-repository ppa:ubuntu-toolchain-r/test 63 1.1 joerg RUN apt-get update && apt install -y gcc-10 g++-10 64 1.1 joerg RUN ln -f -s /usr/bin/g++-10 /usr/bin/g++ && [ -e $(readlink /usr/bin/g++) ] 65 1.1 joerg RUN ln -f -s /usr/bin/gcc-10 /usr/bin/gcc && [ -e $(readlink /usr/bin/gcc) ] 66 1.1 joerg 67 1.1 joerg # Install a recent CMake 68 1.1 joerg RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.sh -O /tmp/install-cmake.sh 69 1.1 joerg RUN bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license 70 1.1 joerg RUN rm /tmp/install-cmake.sh 71 1.1 joerg 72 1.1 joerg # Change the user to a non-root user, since some of the libc++ tests 73 1.1 joerg # (e.g. filesystem) require running as non-root. Also setup passwordless sudo. 74 1.1 joerg RUN apt-get update && apt-get install -y sudo 75 1.1 joerg RUN echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers 76 1.1 joerg RUN useradd --create-home libcxx-builder 77 1.1 joerg USER libcxx-builder 78 1.1 joerg WORKDIR /home/libcxx-builder 79 1.1 joerg 80 1.1 joerg # Install the Buildkite agent and dependencies. This must be done as non-root 81 1.1 joerg # for the Buildkite agent to be installed in a path where we can find it. 82 1.1 joerg RUN bash -c "$(curl -sL https://raw.githubusercontent.com/buildkite/agent/master/install.sh)" 83 1.1 joerg ENV PATH="${PATH}:/home/libcxx-builder/.buildkite-agent/bin" 84 1.1 joerg 85 1.1 joerg # By default, start the Buildkite agent (this requires a token). 86 1.1 joerg CMD buildkite-agent start --tags "queue=libcxx-builders" 87