From b5f27e2a0710eb938bab6b7e350cf830e6475c1e Mon Sep 17 00:00:00 2001 From: Francisco <74398368+fkwilken@users.noreply.github.com> Date: Tue, 8 Aug 2023 15:19:03 -0700 Subject: [PATCH] Pr fix dockerfile (#10) (#388) * Fix Password Policy for CI (#384) Fix Dockerfile Run Naming * Fix Docker Container Naming --------- Signed-off-by: fkwilken --- .../DentOsTestbed/Requirements.txt | 2 +- .../DentOsTestbedLib/Requirements.txt | 1 - DentOS_Framework/Dockerfile.base | 2 +- DentOS_Framework/Dockerfile.dev | 8 ++--- DentOS_Framework/Dockerfile.testing | 34 ------------------- DentOS_Framework/run.sh | 6 ++-- 6 files changed, 9 insertions(+), 44 deletions(-) delete mode 100644 DentOS_Framework/Dockerfile.testing diff --git a/DentOS_Framework/DentOsTestbed/Requirements.txt b/DentOS_Framework/DentOsTestbed/Requirements.txt index cc5e1a009..e7ccfdfc7 100644 --- a/DentOS_Framework/DentOsTestbed/Requirements.txt +++ b/DentOS_Framework/DentOsTestbed/Requirements.txt @@ -7,5 +7,5 @@ pytest pytest-asyncio pytest-html pytest-repeat -ixnetwork_restpy +ixnetwork_restpy>=1.1.10 pyvis == 0.1.9 diff --git a/DentOS_Framework/DentOsTestbedLib/Requirements.txt b/DentOS_Framework/DentOsTestbedLib/Requirements.txt index 9565fea93..e323ffa7f 100644 --- a/DentOS_Framework/DentOsTestbedLib/Requirements.txt +++ b/DentOS_Framework/DentOsTestbedLib/Requirements.txt @@ -1,3 +1,2 @@ pyyaml pykwalify -ixnetwork_restpy diff --git a/DentOS_Framework/Dockerfile.base b/DentOS_Framework/Dockerfile.base index 70c9f14c7..a690f1d9a 100644 --- a/DentOS_Framework/Dockerfile.base +++ b/DentOS_Framework/Dockerfile.base @@ -3,7 +3,7 @@ FROM ubuntu:jammy ARG DEBIAN_FRONTEND=noninteractive ENV TZ=US/Pacific -RUN apt-get -o Acquire::Check-Valid-Until=false update +RUN apt-get update RUN apt-get -y upgrade # Are those packages used anywhere? diff --git a/DentOS_Framework/Dockerfile.dev b/DentOS_Framework/Dockerfile.dev index 72de663c2..29cc13493 100644 --- a/DentOS_Framework/Dockerfile.dev +++ b/DentOS_Framework/Dockerfile.dev @@ -20,11 +20,11 @@ RUN pip3 install --no-cache-dir pdbpp==0.10.3 WORKDIR /DENT/DentOsTestbed # Install each time DentOS Framework to use the latest changes from GIT -RUN printf "#!/bin/bash\nDENT_PACKAGES=(\"/DENT/DentOsTestbed\" \"/DENT/DentOsTestbedDiscovery\" \"/DENT/DentOsTestbedLib\")\n" > /entrypoint.sh -RUN printf "pip3 cache purge" >> /entrypoint.sh -RUN printf "[ -z $SKIP_INSTALL ] && for pkg in \${DENT_PACKAGES[@]}; do cd \$pkg; pip3 install --no-cache-dir --root-user-action=ignore .; done" >> /entrypoint.sh +RUN echo "#!/bin/bash\nDENT_PACKAGES=(\"/DENT/DentOsTestbed\" \"/DENT/DentOsTestbedDiscovery\" \"/DENT/DentOsTestbedLib\")\n" > /entrypoint.sh +RUN echo "pip3 cache purge" >> /entrypoint.sh +RUN echo "[ -z $SKIP_INSTALL ] && for pkg in \${DENT_PACKAGES[@]}; do cd \$pkg; pip3 install --no-cache-dir --root-user-action=ignore .; done" >> /entrypoint.sh # `pip3 install --editable` does not work for the packages from above -RUN printf "cd /DENT/DentOsTestbed\n\$@\n" >> /entrypoint.sh +RUN echo "cd /DENT/DentOsTestbed\n\$@\n" >> /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/DentOS_Framework/Dockerfile.testing b/DentOS_Framework/Dockerfile.testing deleted file mode 100644 index f2fd87313..000000000 --- a/DentOS_Framework/Dockerfile.testing +++ /dev/null @@ -1,34 +0,0 @@ -FROM dent-testing-base:latest - -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get -o Acquire::Check-Valid-Until=false update -RUN apt-get install -y \ - vim \ - iputils-ping - -RUN pip3 install --no-cache-dir pdbpp==0.10.3 - -# --editable does not work with those packages -# Once it is fixed, we will be able to simplify entrypoint -# RUN --mount=type=bind,target=/DENT/DentOsTestbed,source=DentOsTestbed,rw \ -# cd /DENT/DentOsTestbed && pip3 install --editable . -# RUN --mount=type=bind,target=/DENT/DentOsTestbedDiscovery,source=DentOsTestbedDiscovery,rw \ -# cd /DENT/DentOsTestbedDiscovery && pip3 install --editable . -# RUN --mount=type=bind,target=/DENT/DentOsTestbedLib,source=DentOsTestbedLib,rw \ -# cd /DENT/DentOsTestbedLib && pip3 install --editable . - -WORKDIR /DENT/DentOsTestbed - -# Install each time DentOS Framework to use the latest changes from GIT -RUN printf "#!/bin/bash\nDENT_PACKAGES=(\"/DENT/DentOsTestbed\" \"/DENT/DentOsTestbedDiscovery\" \"/DENT/DentOsTestbedLib\")\n" > /entrypoint.sh -RUN printf "pip3 cache purge" >> /entrypoint.sh -RUN printf "[ -z $SKIP_INSTALL ] && for pkg in \${DENT_PACKAGES[@]}; do cd \$pkg; pip3 install --no-cache-dir --root-user-action=ignore .; done" >> /entrypoint.sh -# `pip3 install --editable` does not work for the packages from above -RUN printf "cd /DENT/DentOsTestbed\n\$@\n" >> /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"] - -LABEL author="Anton Putria " -LABEL version="1.0" -LABEL description="DENT env for testing" diff --git a/DentOS_Framework/run.sh b/DentOS_Framework/run.sh index b2f3a11a2..63598e66c 100755 --- a/DentOS_Framework/run.sh +++ b/DentOS_Framework/run.sh @@ -8,10 +8,10 @@ SCRIPT_DIR=$(dirname "$0") DOCKERFILE_DIR=$SCRIPT_DIR # Build base image -docker build -f "$DOCKERFILE_DIR"/Dockerfile -t dent-testing-base:latest . +docker build -f "$DOCKERFILE_DIR"/Dockerfile.base -t dent/test-framework-base:latest . # Build working image -docker build -f "$DOCKERFILE_DIR"/Dockerfile.testing -t dent-testing:latest . +docker build -f "$DOCKERFILE_DIR"/Dockerfile.auto -t dent/test-framework-dev:latest . if [ -n "$1" ]; then COMMAND="$*" @@ -23,5 +23,5 @@ docker run \ --mount=type=bind,target=/DENT/DentOsTestbedDiscovery,source="$PWD"/DentOsTestbedDiscovery \ --mount=type=bind,target=/DENT/DentOsTestbedLib,source="$PWD"/DentOsTestbedLib \ --name dent-testing-"$USER" \ - dent-testing:latest \ + dent/test-framework-dev:latest \ "$COMMAND"