1%YAML 1.2 2--- | 3 # Copyright 2023 The gRPC Authors 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 FROM ubuntu:20.04 18 19 # Workaround the "tzdata hangs apt-get install during docker image build" issue for ubuntu20.04 20 # by setting timezone to "Etc/UTC" in advance. 21 RUN echo "Etc/UTC" > /etc/timezone 22 23 RUN apt-get update && apt-get install -y build-essential curl git time wget zip && apt-get clean 24 25 <%include file="../../run_tests_python_deps.include"/> 26 27 # Some bazel tests expect "python" binary to exist 28 RUN ln -s /usr/bin/python3 /usr/bin/python 29 30 # Install Google's LLVM build for Ubuntu 20.04 31 # Heavily inspired by https://github.com/GoogleCloudPlatform/container-definitions/tree/master/ubuntu1804_rbe 32 # See go/llvm-docker 33 # Note that we are using the google's pre-built tools for multiple reasons: 34 # * this is what the "official" rbe-ubuntu18-04 image is using: See https://github.com/GoogleCloudPlatform/layer-definitions/tree/master/layers/ubuntu1804/clang 35 # * for sanitizers to work, we need MSAN and TSAN enabled versions of libc++ 36 # Check https://storage.googleapis.com/clang-builds-stable/clang-ubuntu20_04/latest.txt 37 # for the value of LLVM_LATEST. 38 ARG LLVM_LATEST="f2b94bd7eaa83d853dc7568fac87b1f8bf4ddec6" 39 RUN wget -q https://storage.googleapis.com/clang-builds-stable/clang-ubuntu20_04/clang_r<%text>${LLVM_LATEST}</%text>.tar.gz -O /tmp/clang.tar.gz ${'\\'} 40 && tar -xzf /tmp/clang.tar.gz -C /usr/local && rm /tmp/clang.tar.gz 41 RUN wget -q https://storage.googleapis.com/clang-builds-stable/clang-ubuntu20_04/libcxx_r<%text>${LLVM_LATEST}</%text>.tar.gz -O /tmp/libcxx.tar.gz ${'\\'} 42 && tar -xzf /tmp/libcxx.tar.gz -C /usr/local && rm /tmp/libcxx.tar.gz 43 RUN wget -q https://storage.googleapis.com/clang-builds-stable/clang-ubuntu20_04/libcxx-msan_r<%text>${LLVM_LATEST}</%text>.tar.gz -O /tmp/libcxx-msan.tar.gz ${'\\'} 44 && mkdir -p /usr/local/libcxx-msan && tar -xzf /tmp/libcxx-msan.tar.gz -C /usr/local/libcxx-msan && rm /tmp/libcxx-msan.tar.gz 45 RUN wget -q https://storage.googleapis.com/clang-builds-stable/clang-ubuntu20_04/libcxx-tsan_r<%text>${LLVM_LATEST}</%text>.tar.gz -O /tmp/libcxx-tsan.tar.gz ${'\\'} 46 && mkdir -p /usr/local/libcxx-tsan && tar -xzf /tmp/libcxx-tsan.tar.gz -C /usr/local/libcxx-tsan && rm /tmp/libcxx-tsan.tar.gz 47 RUN wget -q https://storage.googleapis.com/clang-builds-stable/clang-ubuntu20_04/lld_r<%text>${LLVM_LATEST}</%text>.tar.gz -O /tmp/lld.tar.gz ${'\\'} 48 && tar -xzf /tmp/lld.tar.gz -C /usr/local && rm /tmp/lld.tar.gz 49 50 ENV ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer 51 ENV CC=/usr/local/bin/clang 52 ENV GCOV=/dev/null 53 ENV LD_LIBRARY_PATH=/usr/local/lib/x86_64-unknown-linux-gnu 54 ENV MSAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer 55 ENV TSAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer 56 ENV UBSAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer 57 58 # TODO(jtattermusch): Remove python2 once some tests stop failing without it. 59 RUN apt-get update && apt-get install -y python2 && apt-get clean 60 61 # Define the default command. 62 CMD ["bash"] 63