From a2f29f6eb9b7f44b4fdfe8fb5a882869e6d9d481 Mon Sep 17 00:00:00 2001 From: Emil Rossing Date: Sat, 9 Dec 2023 12:11:03 +0100 Subject: [PATCH 1/5] Changed entrypoint to include 'dockerserve' arg. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32c0d629..d94e3edb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9.16-buster +FROM python:3.12.1 WORKDIR /mnt @@ -13,6 +13,6 @@ RUN apt-get update -y && \ python -m pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt -ENTRYPOINT ["make"] +ENTRYPOINT ["make", "dockerserve"] EXPOSE 8080 \ No newline at end of file From 752fda8b1ab6651e2cc5f39c97cebc6cd34dd9ba Mon Sep 17 00:00:00 2001 From: Emil Rossing Date: Sat, 9 Dec 2023 12:12:08 +0100 Subject: [PATCH 2/5] Migrated Windows run-tasks from cmd batch file to powershell (ps1) and updated README --- README.md | 13 ++++++++----- run-task.bat | 1 - run-task.ps1 | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 run-task.bat create mode 100644 run-task.ps1 diff --git a/README.md b/README.md index b900692f..1a95b116 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ODK-X Docs -![Platform](https://img.shields.io/badge/platform-Sphinx-blue.svg) [![License](https://img.shields.io/badge/license-CC%20BY%204.0-blue.svg)](https://creativecommons.org/licenses/by/4.0/) [![Build status](https://circleci.com/gh/odk-x/docs.svg?style=svg)](https://circleci.com/gh/odk-x/docs/) [![Netlify Status](https://api.netlify.com/api/v1/badges/d3788b3e-1abc-431d-a9a3-e5c71b20e053/deploy-status)](https://app.netlify.com/sites/blissful-bohr-7f32fb/deploys) +![Platform](https://img.shields.io/badge/platform-Sphinx-blue.svg) [![License](https://img.shields.io/badge/license-CC%20BY%204.0-blue.svg)](https://creativecommons.org/licenses/by/4.0/) [![Build status](https://circleci.com/gh/odk-x/docs.svg?style=svg)](https://circleci.com/gh/odk-x/docs/) This repo is the source for ODK-X documentation. @@ -93,14 +93,17 @@ Take note of the full-stop `.` at the end of the build command. The `.` specifie ### Building and serving the docs locally Build and serve the docs locally with: - * Windows: `.\run-task.bat serve` - * Linux/macOS: `./run-task.sh serve` + * Windows: `.\run-task.ps1` + * Linux/macOS: `./run-task.sh` Once your terminal shows a "Serving on http://0.0.0.0:8080" message, you can then view the docs in your browser at http://localhost:8080. -Changes you make in the source files will automatically be built and shown in your browser. +Changes you make in the source files (located in the `./src` folder) will automatically be re-built and shown in your browser. + +* Linux/macOs: Press `Ctrl-C` on your keyboard to stop the build server. It could take a while to effectively stop, and you can always close the terminal window. + +* Windows: To stop the build server open up a new terminal and type the command ```docker stop odkx-docs``` -Press `Ctrl-C` on your keyboard to stop the build server. It could take a while to effectively stop, and you can always close the terminal window. If you get a `The name "odkx-docs" is already in use by container` error message, run the following command: diff --git a/run-task.bat b/run-task.bat deleted file mode 100644 index 27e818f6..00000000 --- a/run-task.bat +++ /dev/null @@ -1 +0,0 @@ -docker run --rm -v "%~dp0:/mnt" -p 8080:8080 --name odkx-docs odkx-docs %1 diff --git a/run-task.ps1 b/run-task.ps1 new file mode 100644 index 00000000..54a6de9d --- /dev/null +++ b/run-task.ps1 @@ -0,0 +1 @@ +docker run --rm -v "${PWD}:/mnt" -p 8000:8000 --name odkx-docs odkx-docs $args \ No newline at end of file From 4f1bff38b6c329278c2e7123ed3574358b4ef90a Mon Sep 17 00:00:00 2001 From: Emil Rossing Date: Sat, 9 Dec 2023 12:12:54 +0100 Subject: [PATCH 3/5] Added dockerserve command to Makefile binding to 0.0.0.0 to support docker bridge --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index b9374c6e..090e9e77 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ help: .PHONY: help Makefile +dockerserve: + sphinx-autobuild --host 0.0.0.0 --port 8080 -b dirhtml "$(SOURCE_DIR)" "$(BUILD_DIR)/html" + serve: sphinx-autobuild -b dirhtml "$(SOURCE_DIR)" "$(BUILD_DIR)/html" From f7ee991bec9206a4b50d7cbef026abb793ffe20a Mon Sep 17 00:00:00 2001 From: Emil Date: Sat, 9 Dec 2023 12:25:49 +0100 Subject: [PATCH 4/5] Removed required arg from run-task.sh --- run-task.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-task.sh b/run-task.sh index 4686f796..9214481f 100755 --- a/run-task.sh +++ b/run-task.sh @@ -2,4 +2,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -docker run --rm -v "${DIR}":/mnt -p 8080:8080 --name odkx-docs odkx-docs "$1" +docker run --rm -v "${DIR}":/mnt -p 8080:8080 --name odkx-docs odkx-docs From 8dc93dca5323f4fa22e164442001822c177c8574 Mon Sep 17 00:00:00 2001 From: Emil Rossing Date: Sat, 9 Dec 2023 12:34:30 +0100 Subject: [PATCH 5/5] Updated readme and removed arg from run-task.ps1 --- README.md | 12 ++++++++++-- run-task.ps1 | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1a95b116..6eca14d3 100644 --- a/README.md +++ b/README.md @@ -100,9 +100,17 @@ Once your terminal shows a "Serving on http://0.0.0.0:8080" message, you can the Changes you make in the source files (located in the `./src` folder) will automatically be re-built and shown in your browser. -* Linux/macOs: Press `Ctrl-C` on your keyboard to stop the build server. It could take a while to effectively stop, and you can always close the terminal window. +* Windows: The docker container with the docs website will occupy the terminal window and output log messages when changes are detected and rebuilds are made. Open a new terminal window/tab to be able to stop the container using the command below. +* Linux/macOs: Open a new terminal to interact with the container or press `Ctrl-Z` on your keyboard to suspend the job. The job will still be running in the background and changes will automatically be rebuilt and served. + + +To stop the container, type the following command + +``` +docker stop odkx-docs +``` + -* Windows: To stop the build server open up a new terminal and type the command ```docker stop odkx-docs``` If you get a `The name "odkx-docs" is already in use by container` error message, run the following command: diff --git a/run-task.ps1 b/run-task.ps1 index 54a6de9d..7efe25bd 100644 --- a/run-task.ps1 +++ b/run-task.ps1 @@ -1 +1 @@ -docker run --rm -v "${PWD}:/mnt" -p 8000:8000 --name odkx-docs odkx-docs $args \ No newline at end of file +docker run --rm -v "${PWD}:/mnt" -p 8000:8000 --name odkx-docs odkx-docs \ No newline at end of file