aboutsummaryrefslogtreecommitdiff
path: root/bionic-amd64-tf-m-build/Dockerfile
blob: 3ac9b322efa2285dc619c1a1d9434c388dcec965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
FROM ubuntu:bionic

ENV DEBIAN_FRONTEND=noninteractive
ENV PATH=/home/buildslave/tools/bin:${PATH}
ENV PLANTUML_JAR_PATH=/usr/share/plantuml/plantuml.jar
ENV PKG_DEPS="\
    build-essential \
    curl \
    default-jre \
    device-tree-compiler \
    doxygen \
    g++-multilib \
    gcc-multilib \
    git \
    graphviz \
    jq \
    libffi-dev \
    libssl-dev \
    openjdk-8-jdk \
    openssh-server \
    perl \
    python \
    python-psutil \
    python3 \
    python3-crypto \
    python3-dev \
    python3-psutil \
    python3-pyasn1 \
    srecord \
    sudo \
    tree \
    unzip \
    virtualenv \
    wget \
    zip \
"

# Can be overriden at build time
ARG BUILDSLAVE_PASSWORD=buildslave
ARG VERSION=3.28

COPY requirements_*.txt /opt/
COPY jenkins-slave /usr/local/bin/jenkins-slave

RUN set -e ;\
    apt update -q=2 ;\
    apt dist-upgrade -q=2 --yes ;\
    apt install -q=2 --yes --no-install-recommends ${PKG_DEPS} ;\
    curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash ;\
    apt update -q=2 ;\
    apt install -q=2 --yes --no-install-recommends git-lfs ;\
    # Install Python requirements
    curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py ;\
    python2 /tmp/get-pip.py ;\
    pip2 install --no-cache-dir -r /opt/requirements_python2.txt ;\
    python3 /tmp/get-pip.py ;\
    pip3 install --no-cache-dir -r /opt/requirements_python3.txt ;\
    # Set Python 3 as default
    ln -s -f /usr/bin/python3 /usr/bin/python ;\
    # Setup buildslave user for Jenkins
    useradd -m -s /bin/bash buildslave ;\
    echo "buildslave:$BUILDSLAVE_PASSWORD" | chpasswd ;\
    echo 'buildslave ALL = NOPASSWD: ALL' > /etc/sudoers.d/jenkins ;\
    chmod 0440 /etc/sudoers.d/jenkins ;\
    mkdir -p /var/run/sshd /home/buildslave/tools ;\
    # Install cppcheck
    wget -q http://github.com/danmar/cppcheck/releases/download/1.81/cppcheck-1.81.tar.gz -O /tmp/cppcheck.tar.gz ;\
    tar -xf /tmp/cppcheck.tar.gz -C /opt ;\
    (cd /opt/cppcheck-*; make CFGDIR=/opt/cppcheck-1.81/cfg; make install; make clean) ;\
    # Install PlantUML
    curl --create-dirs -fsSLo ${PLANTUML_JAR_PATH} https://repo1.maven.org/maven2/net/sourceforge/plantuml/plantuml/1.2019.6/plantuml-1.2019.6.jar ;\
    # Install Jenkins remoting
    curl --create-dirs -fsSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar ;\
    # Install toolchain
    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' ;\
    tar -xf /tmp/gcc-arm-none-eabi-linux.tar.bz2 -C /home/buildslave/tools --strip-components=1 ;\
    # Install CMake
    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 ;\
    tar -xf /tmp/cmake-Linux-x86_64.tar.gz -C /home/buildslave/tools --strip-components=1 ;\
    # Fix permissions
    chmod 0755 /usr/share/jenkins ;\
    chmod 0644 /usr/share/jenkins/slave.jar ;\
    chmod 0755 /usr/local/bin/jenkins-slave ;\
    chown -R buildslave:buildslave /home/buildslave/tools ;\
    # Cleanup
    apt clean ;\
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENTRYPOINT ["/usr/local/bin/jenkins-slave"]