blob: 96960dd094627d96baf0a2d1c070337bb6b776c0 [file] [log] [blame]
Andrew Geissler0205e8d2016-08-10 07:46:19 -05001#!/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
Andrew Geissler8b8333b2018-05-29 13:51:58 -05008# param2: <optional, the distro to build a docker image against>
Andrew Geisslercd1b0ac2019-05-30 11:18:45 -05009# default is ubuntu:bionic
Andrew Geissler0205e8d2016-08-10 07:46:19 -050010
11set -uo pipefail
12
13DOCKER_IMG_NAME=${1:-"openbmc/ubuntu-robot-qemu"}
Andrew Geisslercd1b0ac2019-05-30 11:18:45 -050014DISTRO=${2:-"ubuntu:bionic"}
Andrew Geissler0205e8d2016-08-10 07:46:19 -050015
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
Andrew Geissler8b8333b2018-05-29 13:51:58 -050026FROM ${DOCKER_BASE}${DISTRO}
Andrew Geissler0205e8d2016-08-10 07:46:19 -050027
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 \
Saqib Khan362ca852017-03-21 10:48:46 -050037 python3 \
38 python3-dev \
39 python3-setuptools \
Andrew Geissler0205e8d2016-08-10 07:46:19 -050040 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 \
Rahul Maheshwari6b9bb1e2017-03-13 06:56:12 -050056 curl \
Andrew Geissler7a88f292018-01-04 15:16:02 -060057 build-essential \
58 libpixman-1-0 \
Michael Walshf1e83762018-03-28 15:51:43 -050059 libglib2.0-0 \
Andrew Jeffery6ba68142018-04-05 13:30:52 +093060 sshpass \
61 libasound2 \
62 libfdt1 \
Rahul Maheshwari7285ddb2018-09-20 00:01:40 -050063 libpcre3 \
George Keishingb76c0b62019-02-25 13:16:52 -060064 openssl \
65 libxml2-dev \
George Keishing26dd8e12019-02-26 12:31:11 -060066 libxslt-dev \
Andrew Geisslercd1b0ac2019-05-30 11:18:45 -050067 python3-pip \
Anusha Dathatri39b62802019-12-18 04:01:45 -060068 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
Andrew Geissler0205e8d2016-08-10 07:46:19 -050078
Andrew Geisslercd1b0ac2019-05-30 11:18:45 -050079RUN pip3 install \
Andrew Geissler0205e8d2016-08-10 07:46:19 -050080 tox \
Andrew Geisslercd1b0ac2019-05-30 11:18:45 -050081 requests \
Michael Sheposa4d6d3d2019-08-15 17:11:56 -050082 retrying \
Matthew Barth04881eb2019-09-30 13:28:18 -050083 websocket-client \
Alanny Lopez8594e432017-05-17 15:42:59 -050084 json2yaml \
Andrew Geissler0205e8d2016-08-10 07:46:19 -050085 robotframework \
86 robotframework-requests \
87 robotframework-sshlibrary \
Sunil M55d0d752018-03-22 07:04:17 -050088 robotframework-scplibrary \
George Keishing0e5dd8a2018-12-02 23:17:59 -060089 pysnmp \
Andrew Geisslercd1b0ac2019-05-30 11:18:45 -050090 redfish \
George Keishing26dd8e12019-02-26 12:31:11 -060091 beautifulsoup4 --upgrade \
George Keishing882254f2019-03-05 13:55:29 -060092 lxml \
George Keishing428553d2019-04-02 10:04:11 -050093 jsonschema \
George Keishingae29c892019-10-04 10:49:03 -050094 redfishtool \
Anusha Dathatri39b62802019-12-18 04:01:45 -060095 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
Andrew Geissler0205e8d2016-08-10 07:46:19 -0500109
Andrew Geissler0205e8d2016-08-10 07:46:19 -0500110RUN 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}"