221
|
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:
|
236
|
15 # $ docker run --env-file <secrets> -it $(docker build -q libcxx/utils/ci)
|
221
|
16 #
|
223
|
17 # The environment variables in `<secrets>` should be the ones necessary
|
252
|
18 # to run a BuildKite agent:
|
|
19 #
|
|
20 # BUILDKITE_AGENT_TOKEN=<token>
|
221
|
21 #
|
|
22 # If you're only looking to run the Docker image locally for debugging a
|
|
23 # build bot, see the `run-buildbot-container` script located in this directory.
|
|
24 #
|
|
25 # A pre-built version of this image is maintained on DockerHub as ldionne/libcxx-builder.
|
|
26 # To update the image, rebuild it and push it to ldionne/libcxx-builder (which
|
|
27 # will obviously only work if you have permission to do so).
|
|
28 #
|
236
|
29 # $ docker build -t ldionne/libcxx-builder libcxx/utils/ci
|
221
|
30 # $ docker push ldionne/libcxx-builder
|
|
31 #
|
|
32
|
236
|
33 FROM ubuntu:jammy
|
221
|
34
|
|
35 # Make sure apt-get doesn't try to prompt for stuff like our time zone, etc.
|
|
36 ENV DEBIAN_FRONTEND=noninteractive
|
|
37
|
|
38 RUN apt-get update && apt-get install -y bash curl
|
|
39
|
|
40 # Install various tools used by the build or the test suite
|
252
|
41 #RUN apt-get update && apt-get install -y ninja-build python3 python3-sphinx python3-distutils python3-psutil git gdb ccache
|
|
42 # TODO add ninja-build once 1.11 is available in Ubuntu, also remove the manual installation.
|
|
43 RUN apt-get update && apt-get install -y python3 python3-sphinx python3-distutils python3-psutil git gdb ccache
|
|
44 RUN apt-get update && apt-get install -y wget && \
|
|
45 wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip && \
|
|
46 gunzip /usr/local/bin/ninja.gz && \
|
|
47 chmod a+x /usr/local/bin/ninja
|
236
|
48
|
|
49 # Install dependencies required to run the LLDB data formatter tests
|
|
50 RUN apt-get update && apt-get install -y python3 python3-dev libpython3-dev uuid-dev libncurses5-dev swig3.0 libxml2-dev libedit-dev
|
|
51
|
|
52 # Locales for gdb and localization tests
|
|
53 RUN apt-get update && apt-get install -y language-pack-en language-pack-fr \
|
|
54 language-pack-ja language-pack-ru \
|
|
55 language-pack-zh-hans
|
|
56 # These two are not enabled by default so generate them
|
|
57 RUN printf "fr_CA ISO-8859-1\ncs_CZ ISO-8859-2" >> /etc/locale.gen
|
|
58 RUN mkdir /usr/local/share/i1en/
|
|
59 RUN printf "fr_CA ISO-8859-1\ncs_CZ ISO-8859-2" >> /usr/local/share/i1en/SUPPORTED
|
|
60 RUN locale-gen
|
221
|
61
|
223
|
62 # Install Clang <latest>, <latest-1> and ToT, which are the ones we support.
|
236
|
63 # We also install <latest-2> because we need to support the "latest-1" of the
|
|
64 # current LLVM release branch, which is effectively the <latest-2> of the
|
|
65 # tip-of-trunk LLVM. For example, after branching LLVM 14 but before branching
|
|
66 # LLVM 15, we still need to have Clang 12 in this Docker image because the LLVM
|
|
67 # 14 release branch CI uses it. The tip-of-trunk CI will never use Clang 12,
|
|
68 # though.
|
252
|
69 # LLVM POST-BRANCH bump version
|
|
70 ENV LLVM_HEAD_VERSION=18
|
221
|
71 RUN apt-get update && apt-get install -y lsb-release wget software-properties-common
|
|
72 RUN wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
|
236
|
73 RUN bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 3)) # for CI transitions
|
|
74 RUN bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 2)) # previous release
|
|
75 RUN bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 1)) # latest release
|
|
76 RUN bash /tmp/llvm.sh $LLVM_HEAD_VERSION # current ToT
|
221
|
77
|
252
|
78 # Install clang-scan-deps, which is required to build modules; always all supported versions.
|
|
79 RUN apt-get update && apt-get install -y clang-tools-$(($LLVM_HEAD_VERSION - 3)) \
|
|
80 clang-tools-$(($LLVM_HEAD_VERSION - 2)) \
|
|
81 clang-tools-$(($LLVM_HEAD_VERSION - 1)) \
|
|
82 clang-tools-$LLVM_HEAD_VERSION
|
221
|
83
|
236
|
84 # Install clang-format; always use the lastest stable branch.
|
|
85 RUN apt-get update && apt-get install -y clang-format-$(($LLVM_HEAD_VERSION - 2)) clang-format-$(($LLVM_HEAD_VERSION - 1))
|
221
|
86
|
236
|
87 # Install clang-tidy
|
252
|
88 # TODO(LLVM-17) revert D148831 to only install $(($LLVM_HEAD_VERSION - 1)) and $LLVM_HEAD_VERSION
|
|
89 # The usage of the ToT version is needed due to module issues with Clang 16
|
|
90 RUN apt-get update && apt-get install -y clang-tidy-$(($LLVM_HEAD_VERSION - 2)) clang-tidy-$(($LLVM_HEAD_VERSION - 1)) clang-tidy-$LLVM_HEAD_VERSION
|
236
|
91
|
252
|
92 # Install llvm-dev and libclang-dev to compile custom clang-tidy checks
|
|
93 # TODO(LLVM-17) revert D148831 to only install $(($LLVM_HEAD_VERSION - 1)) and $LLVM_HEAD_VERSION
|
|
94 # The usage of the ToT version is needed due to module issues with Clang 16
|
|
95 RUN apt-get update && apt-get install -y llvm-$(($LLVM_HEAD_VERSION - 2))-dev llvm-$(($LLVM_HEAD_VERSION - 1))-dev llvm-$LLVM_HEAD_VERSION-dev \
|
|
96 libclang-$(($LLVM_HEAD_VERSION - 2))-dev libclang-$(($LLVM_HEAD_VERSION - 1))-dev libclang-$LLVM_HEAD_VERSION-dev \
|
|
97 libomp5-$LLVM_HEAD_VERSION
|
236
|
98
|
|
99 # Install the most recent GCC, like clang install the previous version as a transition.
|
252
|
100 ENV GCC_LATEST_VERSION=13
|
|
101 RUN add-apt-repository ppa:ubuntu-toolchain-r/test
|
236
|
102 RUN apt-get update && apt install -y gcc-$((GCC_LATEST_VERSION - 1)) g++-$((GCC_LATEST_VERSION - 1))
|
223
|
103 RUN apt-get update && apt install -y gcc-$GCC_LATEST_VERSION g++-$GCC_LATEST_VERSION
|
221
|
104
|
252
|
105 # Remove all, no longer needed, apt data
|
|
106 RUN rm -rf /var/lib/apt/lists/*
|
|
107
|
221
|
108 # Install a recent CMake
|
236
|
109 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
|
221
|
110 RUN bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license
|
|
111 RUN rm /tmp/install-cmake.sh
|
|
112
|
252
|
113 # Install a newer CMake for modules
|
|
114 # TODO Remove the duplicated installation when all runtimes can be build with CMake 3.27.
|
|
115 RUN wget https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.sh -O /tmp/install-cmake.sh
|
|
116 RUN bash /tmp/install-cmake.sh --prefix=/opt --exclude-subdir --skip-license
|
|
117 RUN rm /tmp/install-cmake.sh
|
|
118
|
221
|
119 # Change the user to a non-root user, since some of the libc++ tests
|
|
120 # (e.g. filesystem) require running as non-root. Also setup passwordless sudo.
|
|
121 RUN apt-get update && apt-get install -y sudo
|
|
122 RUN echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
123 RUN useradd --create-home libcxx-builder
|
|
124 USER libcxx-builder
|
|
125 WORKDIR /home/libcxx-builder
|
|
126
|
|
127 # Install the Buildkite agent and dependencies. This must be done as non-root
|
|
128 # for the Buildkite agent to be installed in a path where we can find it.
|
236
|
129 RUN bash -c "$(curl -sL https://raw.githubusercontent.com/buildkite/agent/main/install.sh)"
|
221
|
130 ENV PATH="${PATH}:/home/libcxx-builder/.buildkite-agent/bin"
|
223
|
131 RUN echo "tags=\"queue=libcxx-builders,arch=$(uname -m),os=linux\"" >> "/home/libcxx-builder/.buildkite-agent/buildkite-agent.cfg"
|
221
|
132
|
|
133 # By default, start the Buildkite agent (this requires a token).
|
223
|
134 CMD buildkite-agent start
|