• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 The gRPC Authors
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# Pinned version of the base image is used to avoid regressions caused
16# by rebuilding of this docker image. To see available versions, you can run
17# "gcloud container images list-tags gcr.io/oss-fuzz-base/base-builder"
18# This base image is built on Mar 12, 2024
19FROM gcr.io/oss-fuzz-base/base-builder@sha256:c3581153788bc49f3634fec3cd36a5d6dfd26632c4afc157fb6faf8ce3af732e
20
21# -------------------------- WARNING --------------------------------------
22# If you are making changes to this file, consider changing
23# https://github.com/google/oss-fuzz/blob/master/projects/grpc/Dockerfile
24# accordingly.
25# -------------------------------------------------------------------------
26
27# Install basic packages
28RUN apt-get update && apt-get -y install \
29  autoconf \
30  build-essential \
31  curl \
32  libtool \
33  make \
34  vim \
35  wget
36
37#========================
38# Bazel installation
39
40# Must be in sync with tools/bazel
41ENV BAZEL_VERSION 7.1.0
42
43# The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper.
44ENV DISABLE_BAZEL_WRAPPER 1
45
46# Download the correct bazel version and make sure it's on path.
47RUN BAZEL_ARCH_SUFFIX="$(uname -m | sed s/aarch64/arm64/)" \
48  && curl -sSL --fail -o /usr/local/bin/bazel "https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-linux-$BAZEL_ARCH_SUFFIX" \
49  && chmod a+x /usr/local/bin/bazel
50
51# Normally we would run "bazel --version" here to make sure bazel
52# was correctly installed, but we can't do that because
53# of # https://github.com/bazelbuild/bazel/issues/11379.
54# We want to keep the arm64 version of the image buildable
55# on x64 with use of qemu-user-static & binfmt emulation,
56# but the self-extraction is broken for bazel currently.
57# The binary will work correctly when run on real arm64
58# hardware, when qemu-user-static isn't getting into the way.
59
60
61#========================
62# Java
63RUN apt-get install -y openjdk-21-jdk
64
65#========================
66# Android SDK/NDK installation
67ENV ANDROID_SDK_VERSION 11076708
68ENV ANDROID_NDK_VERSION 26.2.11394342
69
70ENV SDK_ROOT /opt/android-sdk
71
72RUN mkdir -p $SDK_ROOT
73RUN cd $SDK_ROOT &&     wget -O cmd.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip &&     unzip -q cmd.zip &&     rm cmd.zip
74
75RUN yes | $SDK_ROOT/cmdline-tools/bin/sdkmanager --sdk_root=$SDK_ROOT --licenses  # accept all licenses
76
77# This is not required but desirable to reduce the time to download and the chance of download failure.
78RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg
79
80RUN $SDK_ROOT/cmdline-tools/bin/sdkmanager --sdk_root=$SDK_ROOT "ndk;$ANDROID_NDK_VERSION" "platforms;android-33" "build-tools;34.0.0"
81
82# Set environment variables for Bazel rules
83ENV ANDROID_HOME $SDK_ROOT
84ENV ANDROID_NDK_HOME $SDK_ROOT/ndk/$ANDROID_NDK_VERSION
85
86# Define the default command.
87CMD ["bash"]
88