Commit 4f256c8d authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Using docker image with bs4

parent 83aa24bd
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
#!/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 ------"