From 4f256c8d70d392316de4891a1eb3ba5a605018b4 Mon Sep 17 00:00:00 2001 From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org> Date: Thu, 11 Jan 2024 08:32:11 +0100 Subject: [PATCH] Using docker image with bs4 --- publish_on_pages.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/publish_on_pages.sh b/publish_on_pages.sh index f05dbe4..6bbd9ec 100644 --- a/publish_on_pages.sh +++ b/publish_on_pages.sh @@ -1,6 +1,6 @@ #!/bin/bash -DOCKER_IMAGE=python:3.9-slim-bullseye +DOCKER_IMAGE=logiqx/python-bs4:3.9-slim echo "\n------ Checking for docker image --------" docker pull "$DOCKER_IMAGE" @@ -22,10 +22,12 @@ else fi set -e +echo "------ Get the previous GitLab Pages content --------" + echo "------ Add/update content --------" if [ $4 == 'upgrade' ]; then echo 'Upgrading index.html...' - docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 -u "$7_$4" "$4/$7_$4.docx" "$5" + docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" python3 $1 -u "$7_$4" "$4/$7_$4.docx" "$5" elif [ $6 == 'true' ]; then echo 'Removing all web pages content...' rm -r public/*; @@ -33,11 +35,11 @@ elif [ $6 == 'false' ]; then mkdir -p "public/$4" ls public/ cp -r -f "$7_$4.docx" public/$4 - docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" /bin/bash -c 'pip install bs4; python3 $1 "$7_$4" "$4/$7_$4.docx" "$5"' + docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" python3 $1 "$7_$4" "$4/$7_$4.docx" "$5" else echo 'Removing entry for ' $6 rm -r -f public/$6 - docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 -re "$7_$4" "$4/$7_$4.docx" "$5" + docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" python3 $1 -re "$7_$4" "$4/$7_$4.docx" "$5" fi echo "------ Zip the content and publish the zip again ------" -- GitLab