Skip to content
Snippets Groups Projects
Commit 4f256c8d authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Using docker image with bs4

parent 83aa24bd
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
DOCKER_IMAGE=python:3.9-slim-bullseye DOCKER_IMAGE=logiqx/python-bs4:3.9-slim
echo "\n------ Checking for docker image --------" echo "\n------ Checking for docker image --------"
docker pull "$DOCKER_IMAGE" docker pull "$DOCKER_IMAGE"
...@@ -22,10 +22,12 @@ else ...@@ -22,10 +22,12 @@ else
fi fi
set -e set -e
echo "------ Get the previous GitLab Pages content --------"
echo "------ Add/update content --------" echo "------ Add/update content --------"
if [ $4 == 'upgrade' ]; then if [ $4 == 'upgrade' ]; then
echo 'Upgrading index.html...' 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 elif [ $6 == 'true' ]; then
echo 'Removing all web pages content...' echo 'Removing all web pages content...'
rm -r public/*; rm -r public/*;
...@@ -33,11 +35,11 @@ elif [ $6 == 'false' ]; then ...@@ -33,11 +35,11 @@ elif [ $6 == 'false' ]; then
mkdir -p "public/$4" mkdir -p "public/$4"
ls public/ ls public/
cp -r -f "$7_$4.docx" public/$4 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 else
echo 'Removing entry for ' $6 echo 'Removing entry for ' $6
rm -r -f public/$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 fi
echo "------ Zip the content and publish the zip again ------" echo "------ Zip the content and publish the zip again ------"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment