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 \ |
| 34 | socat \ |
| 35 | texinfo \ |
| 36 | wget \ |
| 37 | gcc \ |
| 38 | libffi-dev \ |
| 39 | libssl-dev \ |
| 40 | xterm \ |
| 41 | mwm \ |
| 42 | ssh \ |
| 43 | vim \ |
| 44 | iputils-ping \ |
| 45 | sudo \ |
| 46 | cpio \ |
| 47 | unzip \ |
| 48 | diffstat \ |
| 49 | expect \ |
| 50 | curl |
| 51 | |
| 52 | RUN easy_install \ |
| 53 | tox \ |
| 54 | pip \ |
| 55 | requests |
| 56 | |
| 57 | RUN pip install \ |
| 58 | robotframework \ |
| 59 | robotframework-requests \ |
| 60 | robotframework-sshlibrary \ |
| 61 | robotframework-scplibrary |
| 62 | |
| 63 | RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER} |
| 64 | RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} \ |
| 65 | ${USER} |
| 66 | USER ${USER} |
| 67 | ENV HOME ${HOME} |
| 68 | RUN /bin/bash |
| 69 | EOF |
| 70 | ) |
| 71 | |
| 72 | ################################# docker img # ################################# |
| 73 | |
| 74 | # Build above image |
| 75 | docker build -t ${DOCKER_IMG_NAME} - <<< "${Dockerfile}" |