blob: 9705ecd54b41eaf9e63654024d64394dc7777e88 [file] [log] [blame]
Kelley Spoon76bcaed2022-04-29 00:11:35 -05001FROM ubuntu:jammy
2
3# Environment variables used by CI scripts
4ENV DEBIAN_FRONTEND=noninteractive
Kelley Spoon76bcaed2022-04-29 00:11:35 -05005ENV TOOLS_DIR=/home/buildslave/tools
Chris Kay25a5a822022-08-24 12:32:30 +01006ENV RUSTUP_HOME=/usr/local/rustup
7ENV CARGO_HOME=/usr/local/cargo
8ENV PATH=${RUSTUP_HOME}/bin:${CARGO_HOME}/bin:${TOOLS_DIR}/bin:${PATH}
Kelley Spoon76bcaed2022-04-29 00:11:35 -05009ENV PLANTUML_JAR_PATH=/usr/share/plantuml/plantuml.jar
10ENV PKG_DEPS="\
11 bc \
12 bison \
13 build-essential \
Boyan Karatotev7c1b88b2023-02-03 11:19:39 +000014 llvm \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050015 clang-tools \
16 cpio \
17 curl \
18 default-jre \
19 device-tree-compiler \
20 doxygen \
Paul Sokolovskyb7c69592023-02-15 08:50:38 +070021 expect \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050022 exuberant-ctags \
23 file \
24 flex \
25 g++-multilib \
26 gcc-multilib \
27 gdisk \
28 git \
29 gnuplot \
Chris Kay38b498c2023-08-04 17:30:24 +000030 golang-go \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050031 graphviz \
32 jq \
J-Alves4ab2a212023-09-13 17:20:50 +010033 ninja-build \
34 gn \
35 device-tree-compiler \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050036 lcov \
37 libffi-dev \
38 libyaml-dev \
39 libxml-libxml-perl \
40 lld \
41 locales \
Paul Sokolovskyb1878942022-12-14 15:58:18 +030042 openjdk-11-jre-headless \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050043 openssh-server \
44 perl \
45 python3 \
46 python3-pycryptodome \
47 python3-dev \
Arthur She74e63142024-03-11 14:29:11 -070048 python3-git \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050049 python3-psutil \
50 python3-pyasn1 \
51 python3-venv \
52 python2.7 \
53 srecord \
54 sudo \
55 tree \
56 unzip \
57 util-linux \
58 uuid-runtime \
59 virtualenv \
60 wget \
61 zip \
J-Alvesc2ffdd62024-08-01 13:44:42 +010062 libncurses5 \
Kelley Spoon76bcaed2022-04-29 00:11:35 -050063"
64
65# Can be overriden at build time
66ARG BUILDSLAVE_PASSWORD=buildslave
67
68COPY requirements_*.txt /opt/
69COPY tf-*.install /tmp/
70COPY setup-sshd /usr/sbin/setup-sshd
71
Paul Sokolovsky86e18d42022-11-20 23:19:43 +030072# Copy armclang toolchains
Paul Sokolovsky22828612023-10-11 21:06:15 +030073COPY ARMCompiler*.tar.gz /tmp/
Paul Sokolovsky86e18d42022-11-20 23:19:43 +030074
Paul Sokolovsky06beab32022-11-15 19:21:08 +030075RUN set -ex ;\
Kelley Spoon76bcaed2022-04-29 00:11:35 -050076 echo 'locales locales/locales_to_be_generated multiselect C.UTF-8 UTF-8, en_US.UTF-8 UTF-8 ' | debconf-set-selections ;\
77 echo 'locales locales/default_environment_locale select en_US.UTF-8' | debconf-set-selections ;\
78 # Set Python 3 as default
79 ln -s -f /usr/bin/python3 /usr/bin/python ;\
80 # Set symlink for python2 if not present
81 [ -L /usr/bin/python2 ] || ln -s /usr/bin/python2.7 /usr/bin/python2;\
82 apt update -q=2 ;\
83 apt dist-upgrade -q=2 --yes ;\
84 apt install -q=2 --yes --no-install-recommends ${PKG_DEPS} ;\
85 curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash ;\
86 apt update -q=2 ;\
87 apt install -q=2 --yes --no-install-recommends git-lfs ;\
88 # Install Python requirements
89 curl -s https://bootstrap.pypa.io/pip/3.5/get-pip.py -o /tmp/get-pip.py ;\
90 python2 /tmp/get-pip.py ;\
91 pip2 install --no-cache-dir -r /opt/requirements_python2.txt ;\
92 python3 /tmp/get-pip.py ;\
93 pip3 install --no-cache-dir -r /opt/requirements_python3.txt ;\
94 # Setup buildslave user for Jenkins
95 useradd -m -s /bin/bash buildslave ;\
96 echo "buildslave:$BUILDSLAVE_PASSWORD" | chpasswd ;\
97 echo 'buildslave ALL = NOPASSWD: ALL' > /etc/sudoers.d/jenkins ;\
98 chmod 0440 /etc/sudoers.d/jenkins ;\
99 # FIXME: add /arm as a temporary workaround until ARM CI moves to Open CI paths
100 mkdir -p /var/run/sshd ${TOOLS_DIR} /arm ;\
101 # Run shell script(s) to install files, toolchains, etc...
102 bash -ex /tmp/tf-dependencies.install ;\
103 bash -ex /tmp/tf-environment.install ;\
104 # Fix permissions
105 chown -R buildslave:buildslave ${TOOLS_DIR} /usr/share/plantuml /nfs/downloads/linaro /arm ;\
106 # Cleanup
107 apt clean ;\
108 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
109
Chris Kay25a5a822022-08-24 12:32:30 +0100110RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
111 sh -s -- --default-toolchain stable -y
Chris Kay00caca02022-08-25 11:37:24 +0100112RUN cargo install 'tokei@12.1.*'
Chris Kay25a5a822022-08-24 12:32:30 +0100113
Chris Kayde72f462022-10-12 14:03:08 +0100114ENV NVM_DIR="/home/buildslave/.nvm"
115ENV BASH_ENV="${NVM_DIR}/nvm.sh"
116
117RUN echo "BASH_ENV=${BASH_ENV}" >> /etc/environment
118RUN echo "NVM_DIR=${NVM_DIR}" >> /etc/environment
119
120USER buildslave
121
122RUN curl -s "https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh" | bash
123RUN bash -c "nvm install 14"
124
125USER root
126
Kelley Spoon76bcaed2022-04-29 00:11:35 -0500127EXPOSE 22
128ENTRYPOINT ["/usr/sbin/setup-sshd"]