Skip to content

Commit

Permalink
chore: use a virtualenv for working with the docs site
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed May 20, 2024
1 parent 7eb1c07 commit 9580db4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ src/pip-delete-this-directory.txt

TEST-*.xml

tcvenv

**/go.work
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 14 additions & 4 deletions docs/contributing_docs.md
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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

Expand Down

0 comments on commit 9580db4

Please sign in to comment.