diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..4992f6be7243542de6c6a8bb3c077d592bfcff29 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.11-slim-bullseye +WORKDIR /book +RUN apt-get update && apt-get -y install git +COPY requirements.txt requirements.txt +RUN pip install -r requirements.txt +CMD ["./docker.sh"] diff --git a/book/thebe_lite/_static/sphinx-thebe.js b/book/thebe_lite/_static/sphinx-thebe.js index 28a7e08c8beaa95cd24e1a82f1c43834487b4c55..fe250c860cb4e735589cc5b328284aeb2ead0444 100644 --- a/book/thebe_lite/_static/sphinx-thebe.js +++ b/book/thebe_lite/_static/sphinx-thebe.js @@ -311,9 +311,9 @@ function override_pyodide_lookup(fs, server_path) { continue; } - // Find alls all the rows in the html with class="display-name" and a file with a .py extension in the text + // Find alls all the links with .py files in the directory listing // We cannot use DOMParser here since it's running inside a web worker: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API - const regex = /class=\"display-name\".*?\>\<.*?\>(.*?\.py)\<.*?\>/g; + const regex = /\<a href=\"(.*?\.py)\"\>(.*?\.py)\<.*?\>/g; regex.lastIndex = 0; for (const match of request.response.matchAll(regex)) { diff --git a/build-lite.sh b/build-lite.sh index 9ef79264116d0a9578b50a365e3a9d604b8f6a36..1111adb3a2ac0d723afaa0460f63e0f2f3b30d4a 100755 --- a/build-lite.sh +++ b/build-lite.sh @@ -31,6 +31,6 @@ fi # 7. cp: finally copies all files from the /book folder to /book/_build/html find book/ -exec test -f {} \; -print | grep -v "^book/_.*\|.*\.\(md\|ipynb\)\|thebe_lite" | cut -c 6- | xargs -i sh -c 'echo "book/_build/html/{}" | grep -o "^.*/" | xargs -d "\n" mkdir -p; cp book/"{}" book/_build/html/"{}"' -# Serves the files on port 8000, localhost (127.0.0.1:8000) +# Serves the files on port 8000 $python_command -m http.server 8000 --directory book/_build/html & diff --git a/deploy-book.sh b/deploy-book.sh new file mode 100755 index 0000000000000000000000000000000000000000..c6fcad457b30373d00d52b4cda76853a0fb417ca --- /dev/null +++ b/deploy-book.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +docker compose down +docker compose up -d + +docker logs -f mude-book diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..61f7b71df0d48a9c96c49aad1166a69b3ca0068e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + web: + container_name: mude-book + build: . + ports: + - "8000:8000" + volumes: + - type: bind + source: ./ + target: /book + stdin_open: true + tty: true diff --git a/docker.sh b/docker.sh new file mode 100755 index 0000000000000000000000000000000000000000..4737b791f3d54fba7475bba32a32995e5e5e9863 --- /dev/null +++ b/docker.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +./build-lite.sh + +bash diff --git a/stop-deployment.sh b/stop-deployment.sh new file mode 100755 index 0000000000000000000000000000000000000000..6a8204fde97ce97e0efbff75e36efbcfa47fb9a1 --- /dev/null +++ b/stop-deployment.sh @@ -0,0 +1,3 @@ +#!/bin/sh +docker compose down +