xref: /openbmc/openbmc-build-scripts/scripts/build-qemu-robot-docker.sh (revision 0e5dd8a1c595b29fc77a289d73b941cc4e14a059)
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    redfish
79
80RUN wget https://sourceforge.net/projects/ipmitool/files/ipmitool/1.8.18/ipmitool-1.8.18.tar.bz2
81RUN tar xvfj ipmitool-*.tar.bz2
82RUN ./ipmitool-1.8.18/configure
83RUN make
84RUN make install
85
86RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER}
87RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} \
88                    ${USER}
89USER ${USER}
90ENV HOME ${HOME}
91RUN /bin/bash
92EOF
93)
94
95################################# docker img # #################################
96
97# Build above image
98docker build -t ${DOCKER_IMG_NAME} - <<< "${Dockerfile}"
99