|
| 1 | +# Copyright 2021 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +ARG DISTRO_VERSION=33 |
| 16 | +FROM fedora:${DISTRO_VERSION} |
| 17 | +ARG NCPU=4 |
| 18 | + |
| 19 | +# Install the minimal packages needed to compile libcxx, install Bazel, and |
| 20 | +# then compile our code. |
| 21 | +RUN dnf makecache && \ |
| 22 | + dnf install -y ccache clang clang-tools-extra cmake findutils gcc-c++ \ |
| 23 | + git llvm llvm-devel make ninja-build openssl-devel patch python \ |
| 24 | + python3.8 python3-devel python3-lit python-pip tar unzip which wget xz |
| 25 | + |
| 26 | +# Sets root's password to the empty string to enable users to get a root shell |
| 27 | +# inside the container with `su -` and no password. Sudo would not work because |
| 28 | +# we run these containers as the invoking user's uid, which does not exist in |
| 29 | +# the container's /etc/passwd file. |
| 30 | +RUN echo 'root:' | chpasswd |
| 31 | + |
| 32 | +# Install the Python modules needed to run the storage emulator |
| 33 | +RUN pip3 install --upgrade pip |
| 34 | +RUN pip3 install setuptools wheel |
| 35 | +RUN pip3 install git+git://github.com/googleapis/python-storage@8cf6c62a96ba3fff7e5028d931231e28e5029f1c |
| 36 | +RUN pip3 install flask==1.1.2 httpbin==0.7.0 scalpl==0.4.0 \ |
| 37 | + crc32c==2.1 gunicorn==20.0.4 |
| 38 | + |
| 39 | +WORKDIR /var/tmp/build |
| 40 | + |
| 41 | +# Install instructions from: |
| 42 | +# https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo |
| 43 | +RUN git clone --depth=1 --branch llvmorg-11.0.0 https://github.com/llvm/llvm-project |
| 44 | +WORKDIR llvm-project/build |
| 45 | +# configure cmake |
| 46 | +RUN cmake -GNinja ../llvm \ |
| 47 | + -DCMAKE_BUILD_TYPE=Release \ |
| 48 | + -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \ |
| 49 | + -DCMAKE_C_COMPILER=clang \ |
| 50 | + -DCMAKE_CXX_COMPILER=clang++ \ |
| 51 | + -DLLVM_USE_SANITIZER=MemoryWithOrigins \ |
| 52 | + -DCMAKE_INSTALL_PREFIX=/usr |
| 53 | +# build the libraries |
| 54 | +RUN cmake --build . -- cxx cxxabi |
| 55 | +RUN cmake --build . -- install-cxx install-cxxabi |
| 56 | + |
| 57 | +# Install the Cloud SDK and some of the emulators. We use the emulators to run |
| 58 | +# integration tests for the client libraries. |
| 59 | +COPY . /var/tmp/ci |
| 60 | +WORKDIR /var/tmp/downloads |
| 61 | +ENV CLOUDSDK_PYTHON=python3.8 |
| 62 | +RUN /var/tmp/ci/install-cloud-sdk.sh |
| 63 | +ENV CLOUD_SDK_LOCATION=/usr/local/google-cloud-sdk |
| 64 | +ENV PATH=${CLOUD_SDK_LOCATION}/bin:${PATH} |
| 65 | +# The Cloud Pub/Sub emulator needs Java :shrug: |
| 66 | +RUN dnf makecache && dnf install -y java-latest-openjdk |
| 67 | + |
| 68 | +# We need Bazel for this build. |
| 69 | +COPY . /var/tmp/ci |
| 70 | +RUN /var/tmp/ci/install-bazel.sh |
0 commit comments