Skip to content

Commit 3298e9a

Browse files
authored
chore: dockerise docs build (#3060)
* chore: dockerise docs build * chore: remove from exclusion
1 parent 5334660 commit 3298e9a

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ src/pip-delete-this-directory.txt
1313

1414
TEST-*.xml
1515

16-
tcvenv
17-
1816
**/go.work
1917

2018
# VS Code settings

Makefile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,20 @@ tidy-all:
2323

2424
## --------------------------------------
2525

26-
TCENV=tcvenv
27-
PYTHONBIN=./$(TCENV)/bin
28-
29-
tcvenv: tcvenv/touchfile
30-
31-
tcvenv/touchfile:
32-
@echo "Creating docs $(TCENV)..."
33-
test -d $(TCENV) || python3 -m venv $(TCENV)
34-
@echo "Installing requirements..."
35-
. $(PYTHONBIN)/activate; pip install -Ur requirements.txt
36-
touch $(TCENV)/touchfile
26+
DOCS_CONTAINER=mkdocs-container
27+
DOCS_IMAGE=python:3.8
3728

29+
.PHONY: clean-docs
3830
clean-docs:
39-
@echo "Destroying docs $(TCENV)..."
40-
rm -rf $(TCENV)
31+
@echo "Destroying docs"
32+
docker rm -f $(DOCS_CONTAINER) || true
4133

4234
.PHONY: serve-docs
43-
serve-docs: tcvenv
44-
. $(PYTHONBIN)/activate; $(PYTHONBIN)/mkdocs serve
35+
serve-docs:
36+
docker run --rm --name $(DOCS_CONTAINER) -it -p 8000:8000 \
37+
-v $(PWD):/testcontainers-go \
38+
-w /testcontainers-go \
39+
$(DOCS_IMAGE) bash -c "pip install -Ur requirements.txt && mkdocs serve -f mkdocs.yml -a 0.0.0.0:8000"
4540

4641
## --------------------------------------
4742

docs/contributing.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,21 @@ Please refer to the [codeinclude plugin documentation](https://github.com/rnorth
8181

8282
### Previewing rendered content
8383

84-
#### Using Python locally
85-
8684
From the root directory of the repository, you can use the following command to build and serve the documentation locally:
8785

8886
```shell
8987
make serve-docs
9088
```
9189

92-
It will use a Python's virtual environment to install the required dependencies and start a local server at `http://localhost:8000`.
90+
It will use a Docker container to install the required dependencies and start a local server at `http://localhost:8000`.
9391

94-
Once finished, you can destroy the virtual environment with the following command:
92+
Once finished, you can destroy the container with the following command:
9593

9694
```shell
9795
make clean-docs
9896
```
9997

100-
#### PR Preview deployments
98+
### PR Preview deployments
10199

102100
Note that documentation for pull requests will automatically be published by Netlify as 'deploy previews'.
103101
These deployment previews can be accessed via the `deploy/netlify` check that appears for each pull request.

0 commit comments

Comments
 (0)