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