diff --git a/.gitignore b/.gitignore index b6ba580a02..4b420b86b4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ src/pip-delete-this-directory.txt TEST-*.xml +tcvenv + **/go.work \ No newline at end of file diff --git a/Makefile b/Makefile index 2674087e18..17aaad5bb4 100644 --- a/Makefile +++ b/Makefile @@ -12,3 +12,25 @@ test-examples: tidy-all: make -C examples tidy-examples make -C modules tidy-modules + +## ------------------------------------- + +TCENV=tcvenv +PYTHONBIN=./$(TCENV)/bin + +tcvenv: tcvenv/touchfile + +tcvenv/touchfile: + @echo "Creating docs $(TCENV)..." + test -d $(TCENV) || python3 -m venv $(TCENV) + @echo "Installing requirements..." + . $(PYTHONBIN)/activate; pip install -Ur requirements.txt + touch $(TCENV)/touchfile + +clean-docs: + @echo "Destroying docs $(TCENV)..." + rm -rf $(TCENV) + +.PHONY: serve-docs +serve-docs: tcvenv + . $(PYTHONBIN)/activate; $(PYTHONBIN)/mkdocs serve diff --git a/docs/contributing_docs.md b/docs/contributing_docs.md index 46f8714bc8..bf896ea410 100644 --- a/docs/contributing_docs.md +++ b/docs/contributing_docs.md @@ -1,6 +1,6 @@ # Contributing to documentation -The Testcontainers for Go documentation is a static site built with [MkDocs](https://www.mkdocs.org/). +The _Testcontainers for Go_ documentation is a static site built with [MkDocs](https://www.mkdocs.org/). We use the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme, which offers a number of useful extensions to MkDocs. In addition we use a [custom plugin](https://github.com/rnorth/mkdocs-codeinclude-plugin) for inclusion of code snippets. @@ -11,9 +11,19 @@ We publish our documentation using Netlify. ### Using Python locally -* Ensure that you have Python 3.8.0 or higher. -* Set up a virtualenv and run `pip install -r requirements.txt` in the `testcontainers-go` root directory. -* Once Python dependencies have been installed, run `mkdocs serve` to start a local auto-updating MkDocs server. +From the root directory of the repository, you can use the following command to build and serve the documentation locally: + +```shell +make serve-docs +``` + +It will use a Python's virtual environment to install the required dependencies and start a local server at `http://localhost:8000`. + +Once finished, you can destroy the virtual environment with the following command: + +```shell +make clean-docs +``` ### PR Preview deployments