2020-09-23 21:20:03 +08:00
|
|
|
#===----------------------------------------------------------------------===##
|
|
|
|
#
|
|
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#
|
|
|
|
#===----------------------------------------------------------------------===##
|
|
|
|
|
|
|
|
#
|
|
|
|
# This Dockerfile describes the base image used to run the various libc++
|
|
|
|
# build bots. By default, the image runs the Buildkite Agent, however one
|
|
|
|
# can also just start the image with a shell to debug CI failures.
|
|
|
|
#
|
|
|
|
# To start a Buildkite Agent, run it as:
|
2021-06-22 04:21:39 +08:00
|
|
|
# $ docker run --env-file <secrets> -it $(docker build -q .)
|
2020-09-23 21:20:03 +08:00
|
|
|
#
|
2021-06-22 04:21:39 +08:00
|
|
|
# The environment variables in `<secrets>` should be the ones necessary
|
|
|
|
# to run a BuildKite agent.
|
2020-09-23 21:20:03 +08:00
|
|
|
#
|
2021-03-03 01:59:29 +08:00
|
|
|
# If you're only looking to run the Docker image locally for debugging a
|
|
|
|
# build bot, see the `run-buildbot-container` script located in this directory.
|
2020-09-30 00:48:44 +08:00
|
|
|
#
|
2021-03-03 01:59:29 +08:00
|
|
|
# A pre-built version of this image is maintained on DockerHub as ldionne/libcxx-builder.
|
2020-09-30 00:48:44 +08:00
|
|
|
# To update the image, rebuild it and push it to ldionne/libcxx-builder (which
|
|
|
|
# will obviously only work if you have permission to do so).
|
|
|
|
#
|
2021-09-09 21:59:44 +08:00
|
|
|
# $ docker build -t ldionne/libcxx-builder libcxx/utils/ci
|
2020-09-30 00:48:44 +08:00
|
|
|
# $ docker push ldionne/libcxx-builder
|
|
|
|
#
|
2020-09-23 21:20:03 +08:00
|
|
|
|
|
|
|
FROM ubuntu:bionic
|
|
|
|
|
2020-11-06 04:13:27 +08:00
|
|
|
# Make sure apt-get doesn't try to prompt for stuff like our time zone, etc.
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2020-09-23 21:20:03 +08:00
|
|
|
|
2021-09-09 21:59:44 +08:00
|
|
|
# This dummy command is meant to be edited from time to time, which causes the
|
|
|
|
# CI builders to rebuild their copy of the Docker image. This is not a great
|
|
|
|
# solution, however without that, the CI builders will keep the same cached
|
|
|
|
# Docker image forever.
|
|
|
|
RUN echo 1
|
|
|
|
|
2020-11-06 04:13:27 +08:00
|
|
|
RUN apt-get update && apt-get install -y bash curl
|
2020-09-30 00:48:44 +08:00
|
|
|
|
2020-11-06 04:13:27 +08:00
|
|
|
# Install various tools used by the build or the test suite
|
2020-12-17 06:00:09 +08:00
|
|
|
RUN apt-get update && apt-get install -y ninja-build python3 python3-sphinx python3-distutils git gdb
|
2020-12-03 05:35:08 +08:00
|
|
|
RUN apt-get update && apt-get install -y libc6-dev-i386 # Required to cross-compile to 32 bits
|
2020-09-30 00:48:44 +08:00
|
|
|
|
2021-07-09 00:19:53 +08:00
|
|
|
# Install Clang <latest>, <latest-1> and ToT, which are the ones we support.
|
|
|
|
ENV LLVM_LATEST_VERSION=12
|
2020-11-06 04:13:27 +08:00
|
|
|
RUN apt-get update && apt-get install -y lsb-release wget software-properties-common
|
2021-01-07 19:02:56 +08:00
|
|
|
RUN wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
|
2021-07-09 00:19:53 +08:00
|
|
|
RUN bash /tmp/llvm.sh $(($LLVM_LATEST_VERSION - 1)) # previous release
|
|
|
|
RUN bash /tmp/llvm.sh $LLVM_LATEST_VERSION # latest release
|
|
|
|
RUN bash /tmp/llvm.sh $(($LLVM_LATEST_VERSION + 1)) # current ToT
|
2020-09-23 21:20:03 +08:00
|
|
|
|
2021-07-12 23:10:59 +08:00
|
|
|
# Make the ToT Clang the "default" compiler on the system
|
|
|
|
RUN ln -fs /usr/bin/clang++-$(($LLVM_LATEST_VERSION + 1)) /usr/bin/c++ && [ -e $(readlink /usr/bin/c++) ]
|
|
|
|
RUN ln -fs /usr/bin/clang-$(($LLVM_LATEST_VERSION + 1)) /usr/bin/cc && [ -e $(readlink /usr/bin/cc) ]
|
2021-07-09 00:19:53 +08:00
|
|
|
|
2021-01-07 19:02:56 +08:00
|
|
|
# Install clang-format
|
2021-07-09 00:19:53 +08:00
|
|
|
RUN apt-get install -y clang-format-$LLVM_LATEST_VERSION
|
|
|
|
RUN ln -s /usr/bin/clang-format-$LLVM_LATEST_VERSION /usr/bin/clang-format && [ -e $(readlink /usr/bin/clang-format) ]
|
|
|
|
RUN ln -s /usr/bin/git-clang-format-$LLVM_LATEST_VERSION /usr/bin/git-clang-format && [ -e $(readlink /usr/bin/git-clang-format) ]
|
2020-12-17 06:00:09 +08:00
|
|
|
|
2021-07-09 00:19:53 +08:00
|
|
|
# Install the most recent GCC
|
|
|
|
ENV GCC_LATEST_VERSION=11
|
2020-09-23 21:20:03 +08:00
|
|
|
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
|
2021-07-09 00:19:53 +08:00
|
|
|
RUN apt-get update && apt install -y gcc-$GCC_LATEST_VERSION g++-$GCC_LATEST_VERSION
|
|
|
|
|
2020-09-23 21:20:03 +08:00
|
|
|
# Install a recent CMake
|
2021-08-18 01:35:50 +08:00
|
|
|
RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1-linux-x86_64.sh -O /tmp/install-cmake.sh
|
2020-09-23 21:20:03 +08:00
|
|
|
RUN bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license
|
|
|
|
RUN rm /tmp/install-cmake.sh
|
|
|
|
|
2020-09-30 00:48:44 +08:00
|
|
|
# Change the user to a non-root user, since some of the libc++ tests
|
|
|
|
# (e.g. filesystem) require running as non-root. Also setup passwordless sudo.
|
2020-11-06 04:13:27 +08:00
|
|
|
RUN apt-get update && apt-get install -y sudo
|
2020-09-30 00:48:44 +08:00
|
|
|
RUN echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
|
|
RUN useradd --create-home libcxx-builder
|
|
|
|
USER libcxx-builder
|
|
|
|
WORKDIR /home/libcxx-builder
|
2020-09-23 21:20:03 +08:00
|
|
|
|
2020-09-30 00:48:44 +08:00
|
|
|
# Install the Buildkite agent and dependencies. This must be done as non-root
|
|
|
|
# for the Buildkite agent to be installed in a path where we can find it.
|
2020-09-23 21:20:03 +08:00
|
|
|
RUN bash -c "$(curl -sL https://raw.githubusercontent.com/buildkite/agent/master/install.sh)"
|
2020-09-30 00:48:44 +08:00
|
|
|
ENV PATH="${PATH}:/home/libcxx-builder/.buildkite-agent/bin"
|
2021-07-13 04:01:32 +08:00
|
|
|
RUN echo "tags=\"queue=libcxx-builders,arch=$(uname -m),os=linux\"" >> "/home/libcxx-builder/.buildkite-agent/buildkite-agent.cfg"
|
2020-09-23 21:20:03 +08:00
|
|
|
|
|
|
|
# By default, start the Buildkite agent (this requires a token).
|
2021-07-13 04:01:32 +08:00
|
|
|
CMD buildkite-agent start
|