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