blob: f4e05f86375ed50f09ee378ca473948c3ec98e32 [file] [log] [blame]
J-Alvesf826dd02025-05-28 10:55:22 +01001FROM ubuntu:noble
2
3ENV DEBIAN_FRONTEND=noninteractive
4ENV TOOLS_DIR=/home/buildslave/tools
5ENV PATH=${TOOLS_DIR}/bin:${PATH}
6ENV PKG_DEPS="\
7 bc \
8 bison \
9 build-essential \
10 cpio \
11 curl \
12 cmake \
13 default-jdk \
14 flex \
15 git \
16 libglib2.0-0 \
17 libpixman-1-0 \
18 libsdl2-2.0-0 \
19 libssl-dev \
20 openssh-server \
21 python3 \
22 python3-serial \
23 python3-venv \
24 strace \
25 sudo \
26 wget \
27 device-tree-compiler \
28 ninja-build \
29 libncurses6"
30
31# Can be overriden at build time
32ARG BUILDSLAVE_PASSWORD=buildslave
33
34COPY requirements_*.txt /opt/
35COPY tf-*.install /tmp/
36COPY setup-sshd /usr/sbin/setup-sshd
37
38RUN set -ex ;\
39 apt update -q=2 ;\
40 apt install -q=2 --yes --no-install-recommends ${PKG_DEPS} ;
41
42# Preparing for the python3 dependencies in a venv.
43# Adding the bin folder to path, so the respective pip
44# tool is used.
45RUN python3 -m venv /opt/venv
46ENV PATH=${PATH}:/opt/venv/bin
47
48RUN set -ex ;\
49 # Install Python requirements
50 pip install --no-cache-dir -r /opt/requirements_python3.txt ;\
51 # Set Python 3 as default
52 ln -s -f /usr/bin/python3 /usr/bin/python ;\
53 # Setup buildslave user for Jenkins
54 useradd -m -s /bin/bash buildslave ;\
55 echo "buildslave:$BUILDSLAVE_PASSWORD" | chpasswd ;\
56 echo 'buildslave ALL = NOPASSWD: ALL' > /etc/sudoers.d/jenkins ;\
57 chmod 0440 /etc/sudoers.d/jenkins ;\
58 mkdir -p /var/run/sshd ${TOOLS_DIR} ;\
59 # Install Arm GCC toolchain (aarch64-none-elf)
60 curl --connect-timeout 5 --retry 8 --retry-delay 2 --create-dirs -fsSLo /tmp/gcc-arm-x86_64-aarch64-none-elf.tar.xz \
61 https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-elf.tar.xz ;\
62 tar -Jxf /tmp/gcc-arm-x86_64-aarch64-none-elf.tar.xz -C ${TOOLS_DIR} --strip-components=1 ;\
63 # Setup environment for sshd
64 bash -ex /tmp/tf-environment.install ;\
65 # Fix permissions
66 chown -R buildslave:buildslave ${TOOLS_DIR} ;
67
68# Install Clang and LLVM.
69# Use the packages from LLVM's repository rather than the default Ubuntu
70# repository so we can control the exact version.
71ENV LLVM_VERSION=20
72RUN mkdir -p /etc/apt/keyrings
73RUN wget https://apt.llvm.org/llvm-snapshot.gpg.key -O /etc/apt/keyrings/llvm-snapshot.key
74RUN echo "deb [signed-by=/etc/apt/keyrings/llvm-snapshot.key] http://apt.llvm.org/noble/ llvm-toolchain-noble-$LLVM_VERSION main" > /etc/apt/sources.list.d/llvm.list
75RUN echo "deb-src [signed-by=/etc/apt/keyrings/llvm-snapshot.key] http://apt.llvm.org/noble/ llvm-toolchain-noble-$LLVM_VERSION main" >> /etc/apt/sources.list.d/llvm.list
76RUN apt-get update
77RUN apt-get install -y \
78 clang-$LLVM_VERSION \
79 clangd-$LLVM_VERSION \
80 clang-tidy-$LLVM_VERSION \
81 clang-format-$LLVM_VERSION \
82 llvm-$LLVM_VERSION \
83 lld-$LLVM_VERSION \
84 libc++-$LLVM_VERSION-dev
85
86# LLVM binaries are present in `/usr/bin` as `clang-20`, `clang-tidy-20`, etc.
87# But we want them to be available as `clang`, `clang-tidy`, etc.
88# So we create symlinks for them.
89RUN for f in /usr/lib/llvm-$LLVM_VERSION/bin/*; do ln -s "$f" /usr/local/bin; done
90
91# Clear APT cache to save space.
92RUN rm -rf /var/lib/apt/lists/*
93
94EXPOSE 22
95ENTRYPOINT ["/usr/sbin/setup-sshd"]