xref: /openbmc/openbmc-build-scripts/scripts/build-qemu-robot-docker.sh (revision 7285ddb3a51ad9e05f99e4a09122fbc1c1895316)
1#!/bin/bash -xe
2#
3# Build the required docker image to run QEMU and Robot test cases
4#
5#  Parameters:
6#   parm1:  <optional, the name of the docker image to generate>
7#            default is openbmc/ubuntu-robot-qemu
8#   param2: <optional, the distro to build a docker image against>
9#            default is ubuntu:artful
10
11set -uo pipefail
12
13DOCKER_IMG_NAME=${1:-"openbmc/ubuntu-robot-qemu"}
14DISTRO=${2:-"ubuntu:artful"}
15
16# Determine our architecture, ppc64le or the other one
17if [ $(uname -m) == "ppc64le" ]; then
18    DOCKER_BASE="ppc64le/"
19else
20    DOCKER_BASE=""
21fi
22
23################################# docker img # #################################
24# Create docker image that can run QEMU and Robot Tests
25Dockerfile=$(cat << EOF
26FROM ${DOCKER_BASE}${DISTRO}
27
28ENV DEBIAN_FRONTEND noninteractive
29
30RUN apt-get update && apt-get install -yy \
31    debianutils \
32    gawk \
33    git \
34    python \
35    python-dev \
36    python-setuptools \
37    python3 \
38    python3-dev \
39    python3-setuptools \
40    socat \
41    texinfo \
42    wget \
43    gcc \
44    libffi-dev \
45    libssl-dev \
46    xterm \
47    mwm \
48    ssh \
49    vim \
50    iputils-ping \
51    sudo \
52    cpio \
53    unzip \
54    diffstat \
55    expect \
56    curl \
57    build-essential \
58    libpixman-1-0 \
59    libglib2.0-0 \
60    sshpass \
61    libasound2 \
62    libfdt1 \
63    libpcre3 \
64    openssl
65
66RUN easy_install \
67    tox \
68    pip \
69    requests
70
71RUN pip install \
72    json2yaml \
73    robotframework \
74    robotframework-requests \
75    robotframework-sshlibrary \
76    robotframework-scplibrary \
77    pysnmp
78
79RUN wget https://sourceforge.net/projects/ipmitool/files/ipmitool/1.8.18/ipmitool-1.8.18.tar.bz2
80RUN tar xvfj ipmitool-*.tar.bz2
81RUN ./ipmitool-1.8.18/configure
82RUN make
83RUN make install
84
85RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER}
86RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} \
87                    ${USER}
88USER ${USER}
89ENV HOME ${HOME}
90RUN /bin/bash
91EOF
92)
93
94################################# docker img # #################################
95
96# Build above image
97docker build -t ${DOCKER_IMG_NAME} - <<< "${Dockerfile}"
98