Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 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 |
Andrew Geissler | 8b8333b | 2018-05-29 13:51:58 -0500 | [diff] [blame] | 8 | # param2: <optional, the distro to build a docker image against> |
| 9 | # default is ubuntu:artful |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 10 | |
| 11 | set -uo pipefail |
| 12 | |
| 13 | DOCKER_IMG_NAME=${1:-"openbmc/ubuntu-robot-qemu"} |
Andrew Geissler | 8b8333b | 2018-05-29 13:51:58 -0500 | [diff] [blame] | 14 | DISTRO=${2:-"ubuntu:artful"} |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 15 | |
| 16 | # Determine our architecture, ppc64le or the other one |
| 17 | if [ $(uname -m) == "ppc64le" ]; then |
| 18 | DOCKER_BASE="ppc64le/" |
| 19 | else |
| 20 | DOCKER_BASE="" |
| 21 | fi |
| 22 | |
| 23 | ################################# docker img # ################################# |
| 24 | # Create docker image that can run QEMU and Robot Tests |
| 25 | Dockerfile=$(cat << EOF |
Andrew Geissler | 8b8333b | 2018-05-29 13:51:58 -0500 | [diff] [blame] | 26 | FROM ${DOCKER_BASE}${DISTRO} |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 27 | |
| 28 | ENV DEBIAN_FRONTEND noninteractive |
| 29 | |
| 30 | RUN apt-get update && apt-get install -yy \ |
| 31 | debianutils \ |
| 32 | gawk \ |
| 33 | git \ |
| 34 | python \ |
| 35 | python-dev \ |
| 36 | python-setuptools \ |
Saqib Khan | 362ca85 | 2017-03-21 10:48:46 -0500 | [diff] [blame] | 37 | python3 \ |
| 38 | python3-dev \ |
| 39 | python3-setuptools \ |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 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 \ |
Rahul Maheshwari | 6b9bb1e | 2017-03-13 06:56:12 -0500 | [diff] [blame] | 56 | curl \ |
Andrew Geissler | 7a88f29 | 2018-01-04 15:16:02 -0600 | [diff] [blame] | 57 | build-essential \ |
| 58 | libpixman-1-0 \ |
Michael Walsh | f1e8376 | 2018-03-28 15:51:43 -0500 | [diff] [blame] | 59 | libglib2.0-0 \ |
Andrew Jeffery | 6ba6814 | 2018-04-05 13:30:52 +0930 | [diff] [blame] | 60 | sshpass \ |
| 61 | libasound2 \ |
| 62 | libfdt1 \ |
Rahul Maheshwari | 7285ddb | 2018-09-20 00:01:40 -0500 | [diff] [blame] | 63 | libpcre3 \ |
| 64 | openssl |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 65 | |
| 66 | RUN easy_install \ |
| 67 | tox \ |
| 68 | pip \ |
| 69 | requests |
| 70 | |
| 71 | RUN pip install \ |
Alanny Lopez | 8594e43 | 2017-05-17 15:42:59 -0500 | [diff] [blame] | 72 | json2yaml \ |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 73 | robotframework \ |
| 74 | robotframework-requests \ |
| 75 | robotframework-sshlibrary \ |
Sunil M | 55d0d75 | 2018-03-22 07:04:17 -0500 | [diff] [blame] | 76 | robotframework-scplibrary \ |
| 77 | pysnmp |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 78 | |
Rahul Maheshwari | 6b9bb1e | 2017-03-13 06:56:12 -0500 | [diff] [blame] | 79 | RUN wget https://sourceforge.net/projects/ipmitool/files/ipmitool/1.8.18/ipmitool-1.8.18.tar.bz2 |
| 80 | RUN tar xvfj ipmitool-*.tar.bz2 |
| 81 | RUN ./ipmitool-1.8.18/configure |
| 82 | RUN make |
| 83 | RUN make install |
| 84 | |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 85 | RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER} |
| 86 | RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} \ |
| 87 | ${USER} |
| 88 | USER ${USER} |
| 89 | ENV HOME ${HOME} |
| 90 | RUN /bin/bash |
| 91 | EOF |
| 92 | ) |
| 93 | |
| 94 | ################################# docker img # ################################# |
| 95 | |
| 96 | # Build above image |
| 97 | docker build -t ${DOCKER_IMG_NAME} - <<< "${Dockerfile}" |