From d08f7691ab1ecd93e056ad28cd529c57c78124fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sofus=20Albert=20H=C3=B8gsbro=20Rose?= Date: Sun, 13 Aug 2023 22:45:03 +0200 Subject: [PATCH] fix: Adapted to gitea infrastructure, new README. --- README.md | 55 ++++++++++++++++++++++++++++++++++++------------------- run.py | 2 +- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 7d0e3ad..7826758 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,38 @@ -# MDBook Plugins -The following plugins for `mdbook` are in use: -- `linkcheck`: Checks if links in the book are alive. - - **crates.io**: https://crates.io/crates/mdbook-linkcheck -- `mermaid`: Adds support for MermaidJS diagrams. - - **MermaidJS Reference**: https://mermaidjs.github.io/ - - **crates.io**: https://crates.io/crates/mdbook-mermaid -- `toc`: Provides inline Table of Contents support. - - **crates.io**: https://crates.io/crates/mdbook-toc -- `katex`: Provides pre-rendered LaTeX math support. - - **crates.io**: https://crates.io/crates/mdbook-katex -- `admonish`: Provides styled notes, examples, etc. . - - **crates.io**: https://crates.io/crates/mdbook-admonish -- `quiz`: Provides interactive quizzes while reading. - - **crates.io**: https://crates.io/crates/mdbook-quiz +# Containerized `mdbook` +`mdbook` () is an easy way to generate beautiful book-like websites from simple Markdown text files. +This repository compiles and packages a ready-to-use contianer running `mdbook`. -# TODO -- [ ] Do an `all()` thing for the checks +## Easy Book->Website +`mdbook` repositories are very clean: Just a `src/` folder with a bunch of markdown text files. -# Pre-Commit Hooks -https://github.com/compilerla/conventional-pre-commit +`docker-mdbook` makes it easy to turn that clean bundle of text files into a website deployable as a container. +Here's a multi-stage Dockerfile example: +```Dockerfile +#################### +# - Stage: SSG +#################### +FROM git.sofus.io/python-support/docker-mdbook:0.1.0 AS base +COPY . /src + +RUN mdbook build /src --dest-dir /dist + +#################### +# - Stage: Serve Static Files +#################### +FROM ghcr.io/static-web-server/static-web-server:2 +COPY --from=base /dist /app + +ENV SERVER_PORT 8787 +ENV SERVER_ROOT /app +ENV SERVER_LOG_LEVEL info + +USER 5020 +``` +Put this `Dockerfile` in your book repository, then build & run with your favorite container tool: +```bash +podman build . --tag mybook:dev +podman run --rm -it -p 8787:8787 mybook:dev +## In your browser, go to localhost:8787 +``` + +The principle is the same for hot-reloading with ex. `mdbook serve`. diff --git a/run.py b/run.py index f56f7c3..daff41a 100755 --- a/run.py +++ b/run.py @@ -43,7 +43,7 @@ IMAGE_NAME = "docker-mdbook" IMAGE_VERSION = ("0", "4", "34") REGISTRY_HOST = "git.sofus.io" -REGISTRY_USER = "so-rose" +REGISTRY_USER = "python-support" REGISTRY_PASSWORD = subprocess.check_output( ['pass', 'services/home/git.sofus.io/container-registry-token'] ).decode('ascii').strip()