xref: /aosp_15_r20/external/perfetto/infra/ci/sandbox/Dockerfile (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2019 The Android Open Source Project
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# Creates an image that can check out / build / test the perfetto source. The
16# image is used by the Kokoro continuous integration jobs, but is also suitable
17# for local development.
18
19FROM debian:buster
20
21RUN set -ex; \
22    export DEBIAN_FRONTEND=noninteractive; \
23    echo deb http://archive.debian.org/debian buster-backports main > \
24            /etc/apt/sources.list.d/backports.list; \
25    apt-get update; \
26    apt-get -y install python3 python3-pip git curl sudo lz4 tar ccache tini \
27                       libpulse0 libgl1 libxml2 libc6-dev-i386 libtinfo5 \
28                       gnupg2 pkg-config zip g++ zlib1g-dev unzip \
29                       python3-distutils gcc-8 g++-8; \
30    apt-get -y install libc++-8-dev libc++abi-8-dev clang-8; \
31    update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1; \
32    gcc-8 --version; \
33    g++-8 --version; \
34    clang-8 --version; \
35    clang++-8 --version; \
36    pip3 install protobuf pandas grpcio; \
37    groupadd -g 1337 perfetto; \
38    useradd -d /ci/ramdisk -u 1337 -g perfetto perfetto; \
39    apt-get -y autoremove; \
40    rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/*;
41
42RUN set -ex; \
43    curl -LO https://github.com/bazelbuild/bazel/releases/download/7.0.2/bazel-7.0.2-installer-linux-x86_64.sh; \
44    chmod +x bazel-*-installer-linux-x86_64.sh; \
45    ./bazel-*-installer-linux-x86_64.sh; \
46    rm bazel-*-installer-linux-x86_64.sh; \
47    bazel version;
48
49# Chrome/puppeteer deps.
50RUN set -ex; \
51    export DEBIAN_FRONTEND=noninteractive; \
52    apt-get update; \
53    apt-get -y install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 \
54               libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 \
55               libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
56               libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \
57               libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \
58               libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
59               libxtst6 ca-certificates libappindicator1 libnss3 lsb-release \
60               xdg-utils fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei \
61               fonts-thai-tlwg fonts-kacst fonts-freefont-ttf
62
63# Cleanup to reduce image size
64RUN     apt-get -y autoremove; \
65        rm -rf /var/lib/apt/lists/* /usr/share/man/* /usr/share/doc/*; \
66        rm -rf /root/.cache/;
67
68COPY testrunner.sh /ci/testrunner.sh
69COPY init.sh /ci/init.sh
70RUN chmod -R a+rx /ci/
71
72VOLUME [ "/ci/cache", "/ci/ramdisk", "/ci/artifacts" ]
73ENTRYPOINT [ "tini", "-g", "--" ]
74CMD [ "bash", "/ci/init.sh" ]
75
76