summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.dockerignore10
-rw-r--r--docker/Dockerfile86
-rwxr-xr-xsetup.sh106
3 files changed, 123 insertions, 79 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..0ea94323
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,10 @@
+docker/
+Dockerfile
+.dockerignore
+.git/
+.gitattributes
+.gitignore
+.gitreview
+.idea/
+.project
+.pydevproject \ No newline at end of file
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 7795fa77..c88818dd 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -6,52 +6,54 @@ MAINTAINER "ONAP"
LABEL name="Docker image for the ONAP Robot Testing Framework"
LABEL usage="docker run -e ROBOT_TEST=<testname> -ti openecompete"
-# Install Python Pip, Robot framework, firefox, lighttpd web server, wget
-# Restructuring so we can see where it fails in the build.
-RUN apt-get update
-RUN apt-get --assume-yes install python2.7
-RUN apt-get --assume-yes install build-essential
-RUN apt-get --assume-yes install dbus
-RUN apt-get --assume-yes install dnsutils
-RUN apt-get --assume-yes install git
-RUN apt-get --assume-yes install libappindicator1
-RUN apt-get --assume-yes install libffi-dev
-RUN apt-get --assume-yes install libindicator7
-RUN apt-get --assume-yes install libssl-dev
-RUN apt-get --assume-yes install libxss1
-RUN apt-get --assume-yes install lighttpd
-RUN apt-get --assume-yes install net-tools
-RUN apt-get --assume-yes install python-dev
-RUN apt-get --assume-yes install python-pip
-RUN apt-get --assume-yes install unzip
-RUN apt-get --assume-yes install wget
-RUN apt-get --assume-yes install xvfb
-RUN apt-get --assume-yes install xxd
-RUN pip install --upgrade pip
-RUN pip install robotframework==3.0.4
-RUN python --version
-
-# Install chrome
-RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
- echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
- apt-get update && \
- apt-get --assume-yes install google-chrome-stable
+ENV BUILDTIME=true
+
+# Install Python, Pip, Robot framework, chromium, lighttpd web server
+RUN apt-get update \
+ && apt-get install \
+ --no-install-recommends \
+ --assume-yes \
+ chromium-browser \
+ chromium-chromedriver \
+ dnsutils \
+ git \
+ gcc \
+ libffi-dev \
+ libssl-dev \
+ lighttpd \
+ make \
+ net-tools \
+ python2.7 \
+ python-dev \
+ python-setuptools \
+ python-wheel \
+ python-pip \
+ unzip \
+ x11-utils \
+ x11-xserver-utils \
+ xvfb \
+ xxd
+
+
+RUN pip install robotframework==3.0.4 \
+ && python --version
# Copy the robot code
-COPY / /var/opt/ONAP/
+COPY . /var/opt/ONAP/
COPY lighttpd.conf /etc/lighttpd/lighttpd.conf
COPY authorization /etc/lighttpd/authorization
-RUN chmod 777 /var/opt/ONAP/setup.sh && \
- chmod 777 /var/opt/ONAP/runTags.sh && \
- chmod 777 /var/opt/ONAP/dnstraffic.sh && \
- chmod 777 /var/opt/ONAP/runSoak.sh && \
- chmod 777 /var/opt/ONAP/runEteTag.sh
-
-# Set mode for the SSH keys
-RUN chmod 600 /var/opt/ONAP/robot/assets/keys/*
-
-# Update the ssh library so that it will run properly in the docker env
-RUN cd /var/opt/ONAP && ./setup.sh && apt-get clean
+RUN chmod 777 /var/opt/ONAP/setup.sh \
+ && chmod 777 /var/opt/ONAP/runTags.sh \
+ && chmod 777 /var/opt/ONAP/dnstraffic.sh \
+ && chmod 777 /var/opt/ONAP/runSoak.sh \
+ && chmod 777 /var/opt/ONAP/runEteTag.sh \
+ && chmod 600 /var/opt/ONAP/robot/assets/keys/*
+
+RUN cd /var/opt/ONAP \
+ && ./setup.sh \
+ && apt-get autoremove --assume-yes \
+ && rm -rf /var/lib/apt/lists/* \
+ && apt-get clean
CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"]
diff --git a/setup.sh b/setup.sh
index 1c326a5f..50e344ab 100755
--- a/setup.sh
+++ b/setup.sh
@@ -13,12 +13,25 @@ exec 2> >(tee -a ${LOG_FILE} >&2)
# get the path
path=$(pwd)
-
-pip install --no-cache-dir --target="$path/robot/library" 'selenium<=3.0.0' 'requests==2.11.1' 'robotframework-selenium2library==1.8.0' \
-'robotframework-databaselibrary==0.8.1' 'robotframework-extendedselenium2library==0.9.1' 'robotframework-requests==0.5.0' \
+pip install \
+--no-cache-dir \
+--exists-action s \
+--target="$path/robot/library" \
+'selenium<=3.0.0' \
+'requests==2.11.1' \
+'robotframework-selenium2library==1.8.0' \
+'robotframework-databaselibrary==0.8.1' \
+'robotframework-extendedselenium2library==0.9.1' \
+'robotframework-requests==0.5.0' \
'robotframework-sshlibrary==2.1.2' \
-'robotframework-sudslibrary==0.8' 'robotframework-ftplibrary==1.3' 'robotframework-rammbock==0.4.0.1' \
-'deepdiff==2.5.1' 'dnspython==1.15.0' 'robotframework-httplibrary==0.4.2' 'robotframework-archivelibrary==0.3.2' 'PyYAML==3.12' \
+'robotframework-sudslibrary==0.8' \
+'robotframework-ftplibrary==1.3' \
+'robotframework-rammbock==0.4.0.1' \
+'deepdiff==2.5.1' \
+'dnspython==1.15.0' \
+'robotframework-httplibrary==0.4.2' \
+'robotframework-archivelibrary==0.3.2' \
+'PyYAML==3.12' \
'robotframework-kafkalibrary==0.0.2'
@@ -39,7 +52,12 @@ else
cd python-testing-utils
fi
fi
-pip install --no-cache-dir --upgrade --target="$path/robot/library" .
+
+pip install \
+--no-cache-dir \
+--upgrade \
+--exists-action s \
+--target="$path/robot/library" .
if [ -d $path/testsuite/heatbridge ]
@@ -58,47 +76,63 @@ else
cd heatbridge
fi
fi
-pip install --no-cache-dir --upgrade --target="$path/robot/library" ./heatbridge
+
+pip install \
+--no-cache-dir \
+--upgrade \
+--exists-action s \
+--target="$path/robot/library" \
+./heatbridge
# NOTE: Patch to incude explicit install of paramiko to 2.0.2 to work with sshlibrary 2.1.2
# This should be removed on new release of paramiko (2.1.2) or sshlibrary
# https://github.com/robotframework/SSHLibrary/issues/157
-pip install --no-cache-dir --target="$path/robot/library" -U 'paramiko==2.0.2'
+pip install \
+--no-cache-dir \
+--target="$path/robot/library" \
+-U 'paramiko==2.0.2'
# Go back to execution folder
cd $path
-
-#
-# Get the appropriate chromedriver. Default to linux64
-#
-CHROMEDRIVER_URL=http://chromedriver.storage.googleapis.com/2.43
-CHROMEDRIVER_ZIP=chromedriver_linux64.zip
-
-# Handle mac and windows
-OS=`uname -s`
-case $OS in
- MINGW*_NT*)
- CHROMEDRIVER_ZIP=chromedriver_win32.zip
- ;;
- Darwin*)
- CHROMEDRIVER_ZIP=chromedriver_mac64.zip
- ;;
- *) echo "Defaulting to Linux 64" ;;
-esac
-
-if [ $CHROMEDRIVER_ZIP == 'chromedriver_linux64.zip' ]
+# if the script is running during the image build skip the rest of it
+# as required software is installed already.
+if $BUILDTIME
then
- wget -O chromedriver.zip $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP
- unzip chromedriver.zip -d /usr/local/bin
-else
- curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o chromedriver.zip
- unzip chromedriver.zip
+ echo "Skipping desktop steps, building container image..."
+else
+ #
+ # Get the appropriate chromedriver. Default to linux64
+ #
+ CHROMEDRIVER_URL=http://chromedriver.storage.googleapis.com/2.43
+ CHROMEDRIVER_ZIP=chromedriver_linux64.zip
+ CHROMEDRIVER_TARGET=chromedriver.zip
+
+ # Handle mac and windows
+ OS=`uname -s`
+ case $OS in
+ MINGW*_NT*)
+ CHROMEDRIVER_ZIP=chromedriver_win32.zip
+ ;;
+ Darwin*)
+ CHROMEDRIVER_ZIP=chromedriver_mac64.zip
+ ;;
+ *) echo "Defaulting to Linux 64" ;;
+ esac
+
+ if [ $CHROMEDRIVER_ZIP == 'chromedriver_linux64.zip' ]
+ then
+ curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
+ unzip chromedriver.zip -d /usr/local/bin
+ else
+ curl $CHROMEDRIVER_URL/$CHROMEDRIVER_ZIP -o $CHROMEDRIVER_TARGET
+ unzip $CHROMEDRIVER_TARGET
+ fi
+ rm -rf $CHROMEDRIVER_TARGET
fi
-
#
# Install kafkacat : https://github.com/edenhill/kafkacat
#
@@ -109,8 +143,6 @@ case $OS in
Linux)
apt-get -y install kafkacat
esac
-
-
#
# Install protobuf
#
@@ -120,4 +152,4 @@ case $OS in
brew install protobuf ;;
Linux)
apt-get -y install protobuf-compiler
-esac
+esac \ No newline at end of file