• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 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# The aarch64 wheels are being crosscompiled to allow running the build
16# on x64 machine. The dockcross/linux-armv7 image is a x86_64
17# image with crosscompilation toolchain installed
18
19# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template`!!!
20FROM dockcross/linux-armv7
21
22RUN apt update && apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev \
23                                 libnss3-dev libssl-dev libreadline-dev libffi-dev && apt-get clean
24
25ADD install_python_for_wheel_crosscompilation.sh /scripts/install_python_for_wheel_crosscompilation.sh
26
27RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.8.8" "3.8.8" /opt/python/cp38-cp38
28RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.9.2" "3.9.2" /opt/python/cp39-cp39
29RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.10.0" "3.10.0rc1" /opt/python/cp310-cp310
30RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.11.0" "3.11.0rc1" /opt/python/cp311-cp311
31RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.12.0" "3.12.0rc2" /opt/python/cp312-cp312
32RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.13.0" "3.13.0rc2" /opt/python/cp313-cp313
33
34ENV AUDITWHEEL_ARCH armv7l
35ENV AUDITWHEEL_PLAT linux_armv7l
36
37#=================
38# Install ccache
39
40# Install ccache from source since ccache 3.x packaged with most linux distributions
41# does not support Redis backend for caching.
42RUN unset CMAKE_TOOLCHAIN_FILE && unset AS AR CC CPP CXX LD STRIP OBJCOPY \
43    && curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \
44    && tar -zxf ccache.tar.gz \
45    && cd ccache-4.7.5 \
46    && mkdir build && cd build \
47    && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \
48    && make -j4 && make install \
49    && cd ../.. \
50    && rm -rf ccache-4.7.5 ccache.tar.gz
51
52
53# The dockcross base of this image sets CC and CXX to absolute paths, which makes it impossible to redirect their invocations
54# to ccache via a symlink. Use relative paths instead.
55
56ENV CC ${CROSS_TRIPLE}-gcc
57ENV CXX ${CROSS_TRIPLE}-g++
58
59
60# For historical reasons, task_runner.py the script under docker container using "bash -l"
61# which loads /etc/profile on startup. dockcross/linux-armv7 is based on an image where
62# /etc/profile overwrites contents of PATH (for security reasons) when run as root.
63# That causes the crosscompiler binaries located under /usr/xcc/armv7-unknown-linux-gnueabi/bin
64# to be removed from PATH. Since in our builds we don't need the /etc/profile for anything, we can just
65# truncate it.
66# TODO(jtattermusch): Remove this hack when possible.
67RUN echo "# file contents removed to avoid resetting PATH set by the docker image" >/etc/profile
68
69# TODO: simplify the list of third_party modules list
70# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories
71# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule
72RUN git config --global --add safe.directory /var/local/jenkins/grpc
73RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git
74RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty
75RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds
76RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis
77RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest
78RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry
79RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto
80RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel
81RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api
82RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf
83RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib
84RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark
85RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2
86RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp
87RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp
88RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate
89RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares
90RUN git config --global protocol.file.allow always
91