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