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 xvfb 70 71RUN apt-get update -qqy \ 72 && apt-get -qqy --no-install-recommends install firefox \ 73 && wget --no-verbose -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/72.0/linux-x86_64/en-US/firefox-72.0.tar.bz2 \ 74 && apt-get -y purge firefox \ 75 && tar -C /opt -xjf /tmp/firefox.tar.bz2 \ 76 && mv /opt/firefox /opt/firefox-72.0 \ 77 && ln -fs /opt/firefox-72.0/firefox /usr/bin/firefox 78 79RUN pip3 install \ 80 tox \ 81 requests \ 82 retrying \ 83 websocket-client \ 84 json2yaml \ 85 robotframework \ 86 robotframework-requests \ 87 robotframework-sshlibrary \ 88 robotframework-scplibrary \ 89 pysnmp \ 90 redfish \ 91 beautifulsoup4 --upgrade \ 92 lxml \ 93 jsonschema \ 94 redfishtool \ 95 redfish_utilities \ 96 robotframework-httplibrary \ 97 robotframework-seleniumlibrary \ 98 robotframework-xvfb \ 99 robotframework-angularjs \ 100 scp \ 101 selenium==3.141.0 \ 102 urllib3 \ 103 xvfbwrapper 104 105RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz \ 106 && tar xvzf geckodriver-*.tar.gz \ 107 && mv geckodriver /usr/local/bin \ 108 && chmod a+x /usr/local/bin/geckodriver 109 110RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER} 111RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} \ 112 ${USER} 113USER ${USER} 114ENV HOME ${HOME} 115RUN /bin/bash 116EOF 117) 118 119################################# docker img # ################################# 120 121# Build above image 122docker build -t ${DOCKER_IMG_NAME} - <<< "${Dockerfile}" 123