blob: 32af422dec4fc48fce87f748e6fd8aeb247f177d (
plain) (
tree)
|
|
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG DISTRO_VERSION=18.04
FROM ubuntu:${DISTRO_VERSION}
RUN apt update && \
apt install -y \
build-essential \
clang \
cmake \
curl \
doxygen \
gawk \
git \
gcc \
golang \
g++ \
libc-ares-dev \
libc-ares2 \
libssl-dev \
make \
ninja-build \
pkg-config \
python-pip \
shellcheck \
tar \
unzip \
wget \
zlib1g-dev
# Install newer c-ares on Ubuntu 16.04.
RUN if grep -q 16.04 /etc/lsb-release; then \
apt remove libc-ares-dev libc-ares2; \
apt install -y automake libtool; \
mkdir -p /var/tmp/Downloads; \
cd /var/tmp/Downloads; \
wget -q https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz; \
tar -xf cares-1_15_0.tar.gz; \
cd /var/tmp/Downloads/c-ares-cares-1_15_0; \
./buildconf && ./configure && make -j $(nproc); \
make install; \
ldconfig; \
fi
# By default, Ubuntu 18.04 does not install the alternatives for clang-format
# and clang-tidy, so we need to manually install those.
RUN if grep -q 18.04 /etc/lsb-release; then \
apt update && apt install -y clang-tidy clang-format-7; \
update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-6.0 100; \
update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-7 100; \
fi
# Install the the buildifier tool, which does not compile with the default
# golang compiler for Ubuntu 16.04 and Ubuntu 18.04.
RUN wget -q -O /usr/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/0.17.2/buildifier
RUN chmod 755 /usr/bin/buildifier
# Install cmake_format to automatically format the CMake list files.
# https://github.com/cheshirekow/cmake_format
# Pin this to an specific version because the formatting changes when the
# "latest" version is updated, and we do not want the builds to break just
# because some third party changed something.
RUN pip install --upgrade pip
RUN pip install numpy cmake_format==0.5.2
# Install grpc from source
WORKDIR /var/tmp/ci
COPY install-grpc.sh /var/tmp/ci
RUN /var/tmp/ci/install-grpc.sh
|