Skip to content

Commit d75fade

Browse files
committed
Documentation for development container image
1 parent 858c4fc commit d75fade

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

CONTRIBUTING.md

+65
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ A newbie-friendly guide on how to set up the necessary tools on Windows is avail
194194

195195
## Building the website using the included Dockerfile
196196

197+
**This has some drawbacks, see [below](#development-container) for an alternative.**
198+
197199
You can also create a Docker container to host the docs. First build
198200
an image from the included Dockerfile.
199201

@@ -212,6 +214,69 @@ This will run a web server on your laptop in port 80. You can view the
212214
content of the user guides by pointing your browser to
213215
[localhost](http://localhost).
214216

217+
### Development container
218+
219+
A [Containerfile](development/Containerfile.development) is included for building a container image with live-reload support.
220+
221+
#### Usage with rootless _Podman_
222+
223+
First, build the container image with the command
224+
225+
```bash
226+
podman build -t docs-development -f development/Containerfile.development .
227+
```
228+
229+
Then, start a container—bind-mounting the repository directory (`./`) to `/csc-user-guide` inside the container and publishing the port `8000`—with
230+
231+
```bash
232+
podman run -it -v ./:/csc-user-guide -p 8000:8000 localhost/docs-development:latest serve
233+
```
234+
235+
The site should be up at `localhost:8000` momentarily.
236+
237+
If you define an alias `mkdocs` for the Podman command like so
238+
239+
```bash
240+
alias mkdocs='podman run -it -v ./:/csc-user-guide -p 8000:8000 localhost/docs-development:latest'
241+
```
242+
243+
running the container is almost like running a regular installation of _MkDocs_:
244+
245+
```console
246+
$ mkdocs --help
247+
Usage: mkdocs [OPTIONS] COMMAND [ARGS]...
248+
249+
MkDocs - Project documentation with Markdown.
250+
251+
Options:
252+
-V, --version Show the version and exit.
253+
-q, --quiet Silence warnings
254+
-v, --verbose Enable verbose output
255+
--color / --no-color Force enable or disable color and wrapping for the output. Default is auto-detect.
256+
-h, --help Show this message and exit.
257+
258+
Commands:
259+
build Build the MkDocs documentation.
260+
get-deps Show required PyPI packages inferred from plugins in mkdocs.yml.
261+
gh-deploy Deploy your documentation to GitHub Pages.
262+
new Create a new MkDocs project.
263+
serve Run the builtin development server.
264+
```
265+
266+
#### Building with upgraded Python dependencies
267+
268+
The file [development/packages.txt](development/packages.txt) contains the currently used Python packages without explicit versions. To build an image with the latest versions for the packages available to _pip_ on the base image (`rockylinux:8`), include `--build-args upgrade=true` for the build command (possibly using a different tag, such as `docs-upgrade`):
269+
270+
```bash
271+
podman build -t docs-upgrade -f development/Containerfile.development --build-args upgrade=true .
272+
```
273+
274+
The image now has the latest available Python packages installed instead of the versions frozen in [requirements.txt](requirements.txt). The upgraded environment can now be, for example, frozen into `requirements.txt` with
275+
276+
```bash
277+
podman run --entrypoint '["/bin/bash", "-c", "pip3 freeze"]' localhost/docs-upgrade:latest > requirements.txt
278+
```
279+
215280
## Finding pages that might be outdated
216281

217282
Each page in Docs CSC shows a "Last update" timestamp. To ensure that content

0 commit comments

Comments
 (0)