blob: 7d66febb3533670c62be5959d3bec364b58a9e25 [file] [log] [blame]
FROM ubuntu:20.04 as ubuntu2004-bazel-java11
ARG BUILDARCH
ENV DEBIAN_FRONTEND="noninteractive"
ENV LANG "C.UTF-8"
ENV LANGUAGE "C.UTF-8"
ENV LC_ALL "C.UTF-8"
### Install packages required by Bazel and its tests
RUN apt-get -y update && \
apt-get -y install --no-install-recommends \
apt-utils \
bind9-host \
build-essential \
clang \
coreutils \
curl \
dnsutils \
ed \
expect \
file \
git \
gnupg2 \
iproute2 \
iputils-ping \
lcov \
less \
libc++-dev \
libncurses5 \
libssl-dev \
llvm \
llvm-dev \
lsb-release \
netcat-openbsd \
openjdk-11-jdk-headless \
python-is-python3 \
python2 \
python2-dev \
python3 \
python3-dev \
python3-pip \
python3-requests \
python3-setuptools \
python3-six \
python3-wheel \
python3-yaml \
software-properties-common \
sudo \
unzip \
wget \
zip \
zlib1g-dev \
&& \
apt-get -y purge apport && \
rm -rf /var/lib/apt/lists/*
# Allow using sudo inside the container.
RUN echo "ALL ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-${BUILDARCH}
FROM ubuntu2004-bazel-java11 AS ubuntu2004-java11
### Install Google Cloud SDK.
### https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt-get update -y && apt-get install google-cloud-sdk -y && \
rm -rf /var/lib/apt/lists/*
### Docker (for legacy rbe_autoconfig)
RUN apt-get -y update && \
apt-get -y install apt-transport-https ca-certificates && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository "deb [arch=$BUILDARCH] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
apt-get -y update && \
apt-get -y install docker-ce && \
rm -rf /var/lib/apt/lists/*
# Bazelisk
RUN LATEST_BAZELISK=$(curl -sSI https://github.com/bazelbuild/bazelisk/releases/latest | grep -i '^location: ' | sed 's|.*/||' | sed $'s/\r//') && \
curl -Lo /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/${LATEST_BAZELISK}/bazelisk-linux-${BUILDARCH} && \
chown root:root /usr/local/bin/bazel && \
chmod 0755 /usr/local/bin/bazel
# Buildifier
RUN LATEST_BUILDIFIER=$(curl -sSI https://github.com/bazelbuild/buildtools/releases/latest | grep -i '^location: ' | sed 's|.*/||' | sed $'s/\r//') && \
curl -Lo /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/${LATEST_BUILDIFIER}/buildifier-linux-${BUILDARCH} && \
chown root:root /usr/local/bin/buildifier && \
chmod 0755 /usr/local/bin/buildifier
FROM ubuntu2004-java11 AS ubuntu2004-java11-kythe
RUN LATEST_KYTHE=v0.0.52 && \
mkdir /usr/local/kythe && \
curl -fsSL https://github.com/kythe/kythe/releases/download/${LATEST_KYTHE}/kythe-{$LATEST_KYTHE}.tar.gz | \
tar xvz --no-same-owner --strip-components 1 --directory /usr/local/kythe && \
chmod -R a+r /usr/local/kythe && \
test -f /usr/local/kythe/WORKSPACE