From dde30d005c57707f34d30ad93dbd39dda677666a Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Thu, 5 Sep 2019 11:37:45 -0500 Subject: [PATCH] Selenium: reduce image download size This PS reduces the net size of the download for the selenium images by reducing their builds to a smaller number of layers. Change-Id: I830de4f4381ac91ff939da75bf01528c3844753b Signed-off-by: Pete Birley --- osh-selenium/Dockerfile.opensuse_15 | 26 +++++++++++++------------- osh-selenium/Dockerfile.ubuntu_bionic | 27 +++++++++++++-------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/osh-selenium/Dockerfile.opensuse_15 b/osh-selenium/Dockerfile.opensuse_15 index 1598347a..5ca9d60a 100644 --- a/osh-selenium/Dockerfile.opensuse_15 +++ b/osh-selenium/Dockerfile.opensuse_15 @@ -3,19 +3,19 @@ FROM ${FROM} LABEL maintainer="cloud-devel@suse.com" COPY linux_signing_key.pub /tmp/ -RUN rpm --import /tmp/linux_signing_key.pub -RUN rm /tmp/linux_signing_key.pub - -RUN zypper --non-interactive addrepo http://dl.google.com/linux/chrome/rpm/stable/x86_64 google_chrome - RUN set -ex ;\ + rpm --import /tmp/linux_signing_key.pub ;\ + rm /tmp/linux_signing_key.pub ;\ + zypper --non-interactive addrepo http://dl.google.com/linux/chrome/rpm/stable/x86_64 google_chrome ;\ zypper --non-interactive refresh ;\ zypper --non-interactive up -y ;\ - zypper --non-interactive install -y python-pip unzip wget google-chrome-stable - -RUN /usr/bin/pip install selenium - -RUN wget --directory-prefix=/tmp/ https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip \ - && unzip /tmp/chromedriver_linux64.zip -d /etc/selenium - -RUN zypper clean -a + zypper --non-interactive install -y \ + python-pip \ + unzip \ + wget \ + google-chrome-stable ;\ + /usr/bin/pip install \ + selenium ;\ + wget --directory-prefix=/tmp/ https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip ;\ + unzip /tmp/chromedriver_linux64.zip -d /etc/selenium ;\ + zypper clean -a diff --git a/osh-selenium/Dockerfile.ubuntu_bionic b/osh-selenium/Dockerfile.ubuntu_bionic index eb3bc60d..92d7e79c 100644 --- a/osh-selenium/Dockerfile.ubuntu_bionic +++ b/osh-selenium/Dockerfile.ubuntu_bionic @@ -1,17 +1,16 @@ ARG FROM=docker.io/ubuntu:bionic FROM ${FROM} -RUN apt-get -y update \ - && apt-get install --no-install-recommends -y python3 python3-pip unzip wget gnupg \ - && python3 -m pip install --upgrade pip \ - && python3 -m pip install selenium - -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && wget --directory-prefix=/tmp/ https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip \ - && unzip /tmp/chromedriver_linux64.zip -d /etc/selenium - -RUN apt-get -y update \ - && apt-get install --no-install-recommends -y google-chrome-stable \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN set -xe; \ + apt-get -y update; \ + apt-get install --no-install-recommends -y python3 python3-pip unzip wget gnupg; \ + python3 -m pip install --upgrade pip; \ + python3 -m pip install selenium; \ + wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -; \ + sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'; \ + wget --directory-prefix=/tmp/ https://chromedriver.storage.googleapis.com/2.44/chromedriver_linux64.zip; \ + unzip /tmp/chromedriver_linux64.zip -d /etc/selenium; \ + apt-get -y update; \ + apt-get install --no-install-recommends -y google-chrome-stable; \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/* /tmp/*