Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 1 | FROM ubuntu:bionic |
| 2 | |
| 3 | ENV DEBIAN_FRONTEND=noninteractive |
| 4 | ENV PATH=/home/buildslave/tools/bin:${PATH} |
| 5 | ENV PLANTUML_JAR_PATH=/usr/share/plantuml/plantuml.jar |
| 6 | ENV PKG_DEPS="\ |
Mate Toth-Pal | 4e6f101 | 2020-07-07 10:13:07 +0200 | [diff] [blame] | 7 | bison \ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 8 | build-essential \ |
| 9 | curl \ |
| 10 | default-jre \ |
| 11 | device-tree-compiler \ |
| 12 | doxygen \ |
Karl Zhang | edefe66 | 2020-09-15 18:12:19 +0800 | [diff] [blame^] | 13 | exuberant-ctags \ |
Mate Toth-Pal | 4e6f101 | 2020-07-07 10:13:07 +0200 | [diff] [blame] | 14 | flex \ |
Benjamin Copeland | 08f7e24 | 2020-06-30 13:38:41 +0100 | [diff] [blame] | 15 | g++-multilib \ |
| 16 | gcc-multilib \ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 17 | git \ |
| 18 | graphviz \ |
| 19 | jq \ |
Karl Zhang | edefe66 | 2020-09-15 18:12:19 +0800 | [diff] [blame^] | 20 | lcov \ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 21 | libffi-dev \ |
| 22 | libssl-dev \ |
| 23 | openjdk-8-jdk \ |
| 24 | openssh-server \ |
| 25 | perl \ |
| 26 | python \ |
| 27 | python-psutil \ |
| 28 | python3 \ |
| 29 | python3-crypto \ |
| 30 | python3-dev \ |
| 31 | python3-psutil \ |
| 32 | python3-pyasn1 \ |
| 33 | srecord \ |
| 34 | sudo \ |
| 35 | tree \ |
| 36 | unzip \ |
| 37 | virtualenv \ |
| 38 | wget \ |
| 39 | zip \ |
| 40 | " |
| 41 | |
| 42 | # Can be overriden at build time |
| 43 | ARG BUILDSLAVE_PASSWORD=buildslave |
| 44 | ARG VERSION=3.28 |
| 45 | |
| 46 | COPY requirements_*.txt /opt/ |
| 47 | COPY jenkins-slave /usr/local/bin/jenkins-slave |
Benjamin Copeland | f7991f2 | 2020-07-30 14:01:21 +0100 | [diff] [blame] | 48 | COPY setup-sshd /usr/sbin/setup-sshd |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 49 | |
| 50 | RUN set -e ;\ |
| 51 | apt update -q=2 ;\ |
| 52 | apt dist-upgrade -q=2 --yes ;\ |
| 53 | apt install -q=2 --yes --no-install-recommends ${PKG_DEPS} ;\ |
| 54 | curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash ;\ |
| 55 | apt update -q=2 ;\ |
| 56 | apt install -q=2 --yes --no-install-recommends git-lfs ;\ |
| 57 | # Install Python requirements |
| 58 | curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py ;\ |
| 59 | python2 /tmp/get-pip.py ;\ |
| 60 | pip2 install --no-cache-dir -r /opt/requirements_python2.txt ;\ |
| 61 | python3 /tmp/get-pip.py ;\ |
| 62 | pip3 install --no-cache-dir -r /opt/requirements_python3.txt ;\ |
Benjamin Copeland | a38e497 | 2020-06-25 10:24:35 +0100 | [diff] [blame] | 63 | # Set Python 3 as default |
| 64 | ln -s -f /usr/bin/python3 /usr/bin/python ;\ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 65 | # Setup buildslave user for Jenkins |
| 66 | useradd -m -s /bin/bash buildslave ;\ |
| 67 | echo "buildslave:$BUILDSLAVE_PASSWORD" | chpasswd ;\ |
| 68 | echo 'buildslave ALL = NOPASSWD: ALL' > /etc/sudoers.d/jenkins ;\ |
| 69 | chmod 0440 /etc/sudoers.d/jenkins ;\ |
| 70 | mkdir -p /var/run/sshd /home/buildslave/tools ;\ |
| 71 | # Install cppcheck |
| 72 | wget -q http://github.com/danmar/cppcheck/releases/download/1.81/cppcheck-1.81.tar.gz -O /tmp/cppcheck.tar.gz ;\ |
| 73 | tar -xf /tmp/cppcheck.tar.gz -C /opt ;\ |
| 74 | (cd /opt/cppcheck-*; make CFGDIR=/opt/cppcheck-1.81/cfg; make install; make clean) ;\ |
| 75 | # Install PlantUML |
| 76 | curl --create-dirs -fsSLo ${PLANTUML_JAR_PATH} https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/1.2019.6/plantuml-1.2019.6.jar ;\ |
| 77 | # Install Jenkins remoting |
| 78 | curl --create-dirs -fsSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar ;\ |
| 79 | # Install toolchain |
Benjamin Copeland | 8257eca | 2020-06-25 10:47:17 +0100 | [diff] [blame] | 80 | curl --create-dirs -fsSLo /tmp/gcc-arm-none-eabi-linux.tar.bz2 'https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2?revision=bc2c96c0-14b5-4bb4-9f18-bceb4050fee7?product=GNU%20Arm%20Embedded%20Toolchain%20Downloads,64-bit,,Linux,7-2018-q2-update' ;\ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 81 | tar -xf /tmp/gcc-arm-none-eabi-linux.tar.bz2 -C /home/buildslave/tools --strip-components=1 ;\ |
| 82 | # Install CMake |
Karl Zhang | f398da1 | 2020-09-08 10:29:46 +0800 | [diff] [blame] | 83 | curl --create-dirs -fsSLo /tmp/cmake-Linux-x86_64.tar.gz https://cmake.org/files/v3.15/cmake-3.15.0-Linux-x86_64.tar.gz ;\ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 84 | tar -xf /tmp/cmake-Linux-x86_64.tar.gz -C /home/buildslave/tools --strip-components=1 ;\ |
| 85 | # Fix permissions |
| 86 | chmod 0755 /usr/share/jenkins ;\ |
| 87 | chmod 0644 /usr/share/jenkins/slave.jar ;\ |
| 88 | chmod 0755 /usr/local/bin/jenkins-slave ;\ |
Benjamin Copeland | 28a11fd | 2020-08-10 11:48:47 +0100 | [diff] [blame] | 89 | chown -R buildslave:buildslave /home/buildslave/tools /usr/share/plantuml ;\ |
Benjamin Copeland | e277215 | 2020-06-17 11:54:56 +0100 | [diff] [blame] | 90 | # Cleanup |
| 91 | apt clean ;\ |
| 92 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
| 93 | |
Benjamin Copeland | f7991f2 | 2020-07-30 14:01:21 +0100 | [diff] [blame] | 94 | EXPOSE 22 |
| 95 | ENTRYPOINT ["/usr/sbin/setup-sshd"] |