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