From c7543a3030eead347b4cd73e21485ccc4cc2cb47 Mon Sep 17 00:00:00 2001 From: efiacor Date: Fri, 31 Mar 2023 10:25:00 +0100 Subject: [ROBOT] Fix docker build process Signed-off-by: efiacor Change-Id: Ic6e9552e0ee09d4a841175abb62306cd6db27ed5 Issue-ID: INT-2210 --- docker/Dockerfile | 122 ++++++++++++++++++++++++++---------------------------- setup.sh | 42 ------------------- 2 files changed, 59 insertions(+), 105 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index d52b4c2f..3ad7181a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,82 +1,78 @@ -FROM ubuntu:20.04 +FROM ubuntu:20.04 as base ## Be careful of Windows newlines MAINTAINER "ONAP" LABEL name="Docker image for the ONAP Robot Testing Framework" LABEL usage="docker run -e ROBOT_TEST= -ti onapete" ENV BUILDTIME=true +ENV DEBIAN_FRONTEND noninteractive -ARG TESTSUITE_TAG=master -ARG PYTHON_UTILS_TAG=master -ARG DEMO_TAG=master -ARG KUBERNETES_VERSION="v1.19.11" -ARG HELM_VERSION="v3.3.4" +ARG KUBERNETES_VERSION="v1.23.8" +ARG HELM_VERSION="v3.8.2" -ARG TESTSUITE_REPO=git.onap.org/testsuite ARG PYTHON_UTILS_REPO=git.onap.org/testsuite/python-testing-utils.git +ARG PYTHON_UTILS_TAG=master + ARG DEMO_REPO=git.onap.org/demo -ARG DEBIAN_FRONTEND=noninteractive +ARG DEMO_TAG=master -COPY requirements.txt requirements.txt +# Install apt packages, Python, Pip, etc +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 \ + netbase \ + unzip \ + zip \ + x11-utils \ + x11-xserver-utils \ + xvfb \ + xxd \ + wget \ + vim \ + python3.8 \ + python3.8-dev \ + python3-pip && \ + ln -s /usr/bin/python3 /usr/bin/python && \ + apt-get autoremove --assume-yes && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get clean -# Install kubectl -# Note: Latest version may be found on: -# https://aur.archlinux.org/packages/kubectl-bin/ +# Get kubectl ADD https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl /usr/local/bin/kubectl +# Get helm ADD https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 get_helm.sh -# 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 \ - netbase \ - unzip zip \ - x11-utils x11-xserver-utils \ - xvfb \ - xxd \ - wget vim \ - python3.8 python3.8-dev python3-pip && \ - ln -s /usr/bin/python3 /usr/bin/python && \ - mkdir -p /var/opt/ONAP && \ - pip3 install --no-cache-dir -r requirements.txt && \ - pip3 install --no-cache-dir \ - git+https://$PYTHON_UTILS_REPO@$PYTHON_UTILS_TAG#egg=robotframework-onap\&subdirectory=robotframework-onap && \ - git clone --depth 1 https://$TESTSUITE_REPO -b $TESTSUITE_TAG /var/opt/ONAP && \ - git clone --depth 1 https://$DEMO_REPO -b $DEMO_TAG /var/opt/ONAP/demo && \ - chmod +x /usr/local/bin/kubectl && \ - chmod 700 get_helm.sh && \ - ./get_helm.sh --version $HELM_VERSION && \ - mkdir -p /app && \ - cp /var/opt/ONAP/setup-hvves.sh /app +COPY requirements.txt requirements.txt + +RUN mkdir -p /var/opt/ONAP && \ + pip3 install --no-cache-dir -r requirements.txt setuptools wheel virtualenv && \ + pip3 install --no-cache-dir git+https://$PYTHON_UTILS_REPO@$PYTHON_UTILS_TAG#egg=robotframework-onap\&subdirectory=robotframework-onap && \ + git clone --depth 1 https://$DEMO_REPO -b $DEMO_TAG /var/opt/ONAP/demo && \ + chmod +x /usr/local/bin/kubectl && \ + chmod 700 get_helm.sh && \ + ./get_helm.sh --version $HELM_VERSION + +COPY html/ /var/opt/ONAP/html +COPY robot/ /var/opt/ONAP/robot +COPY *.sh /var/opt/ONAP/ +COPY docker/lighttpd.conf /etc/lighttpd/lighttpd.conf +COPY docker/authorization /etc/lighttpd/authorization -RUN python3.8 -m pip install --no-cache-dir setuptools wheel -RUN python3.8 -m pip install --no-cache-dir virtualenv +RUN mkdir -p /app && \ + cp /var/opt/ONAP/setup-hvves.sh /app && \ + chmod 600 /var/opt/ONAP/robot/assets/keys/* && \ + chmod 777 /var/opt/ONAP/*.sh && \ + cd /var/opt/ONAP && \ + ./setup.sh -# Copy the robot code -RUN mkdir -p /etc/lighttpd && \ - rm /etc/lighttpd/lighttpd.conf && \ - ln -s /var/opt/ONAP/docker/lighttpd.conf /etc/lighttpd/lighttpd.conf && \ - ln -s /var/opt/ONAP/docker/authorization /etc/lighttpd/authorization && \ - 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/* && \ - 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 2e18a768..ef217128 100755 --- a/setup.sh +++ b/setup.sh @@ -26,51 +26,9 @@ pip install \ 'robotframework-archivelibrary==0.4.0' \ 'robotframework-jsonlibrary==0.3.1' -pip install \ ---pre \ ---no-cache-dir \ ---exists-action s \ ---force-reinstall \ ---upgrade \ ---target="$path/robot/library" \ -git+https://git.onap.org/testsuite/python-testing-utils.git@master#egg=robotframework-onap\&subdirectory=robotframework-onap - - # i dont why we need this, but lets protobuf work in docker touch /var/opt/ONAP/robot/library/google/__init__.py -############################### -# remove heatbridge -# commented out for testing -################################################################ -#if [ -d $path/testsuite/heatbridge ] -#then -# # Support LF build location -# cd $path/testsuite/heatbridge -#else -# cd ~ -# git config --global http.sslVerify false -# if [ -d ~/heatbridge ] -# then -# cd heatbridge -# git pull origin master -# else -# git clone https://gerrit.onap.org/r/testsuite/heatbridge.git -# cd heatbridge -# fi -#fi - -#pip install \ -#--no-cache-dir \ -#--upgrade \ -#--exists-action s \ -#--target="$path/robot/library" \ -#./heatbridge - -#sed -i 's/cinderclient\.v1\.client/cinderclient\.v2\.client/g' /var/opt/ONAP/robot/library/heatbridge/OpenstackManager.py - -################################################################ - # Go back to execution folder cd $path -- cgit 1.2.3-korg