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:bionic 10 11set -uo pipefail 12 13DOCKER_IMG_NAME=${1:-"openbmc/ubuntu-robot-qemu"} 14DISTRO=${2:-"ubuntu:bionic"} 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 libxml2-dev \ 66 libxslt-dev \ 67 python3-pip \ 68 ipmitool 69 70RUN pip3 install \ 71 tox \ 72 requests \ 73 json2yaml \ 74 robotframework \ 75 robotframework-requests \ 76 robotframework-sshlibrary \ 77 robotframework-scplibrary \ 78 pysnmp \ 79 redfish \ 80 beautifulsoup4 --upgrade \ 81 lxml \ 82 jsonschema \ 83 redfishtool 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