xref: /aosp_15_r20/external/grpc-grpc/tools/dockerfile/test/bazel/Dockerfile (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1# Copyright 2015 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# Setup git to access working directory across docker boundary.
62# This avoids the "fatal: detected dubious ownership in repository XYZ"
63# git error.
64
65RUN git config --global --add safe.directory '*'
66RUN git config --global protocol.file.allow always
67
68#=================
69# Setup git to access working directory across docker boundary.
70# This avoids the "fatal: detected dubious ownership in repository XYZ"
71# git error. Using "--system" makes the setting work
72# for all users or even current user is not properly defined
73# (which can happen e.g. inside execution environment
74# of a bazel action)
75
76RUN git config --system --add safe.directory '*'
77RUN git config --system protocol.file.allow always
78
79
80RUN apt-get install -y gdb
81
82RUN mkdir -p /var/local/jenkins
83
84# Define the default command.
85CMD ["bash"]
86