Skip to content

Instantly share code, notes, and snippets.

@JapuDCret
Created June 22, 2023 12:54
Show Gist options
  • Save JapuDCret/753eea351387fd0fd414ad3e7eb6c827 to your computer and use it in GitHub Desktop.
Save JapuDCret/753eea351387fd0fd414ad3e7eb6c827 to your computer and use it in GitHub Desktop.
Serve MkDocs generated docs with PlantUML Support
FROM python:3.11.4-alpine3.18 as build
WORKDIR /usr/src/app
COPY docs/requirements*.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY ./docs/plantuml-install.sh ./plantuml-install.sh
RUN ./plantuml-install.sh
COPY ./mkdocs.yml ./
COPY ./_docs/ ./_docs/
RUN python -m mkdocs build
FROM nginx:stable-alpine
COPY --from=build /usr/src/app/docs/site/ /usr/share/nginx/html
site_name: ...
site_url: ...
repo_url: ...
repo_name: ...
docs_dir: _docs/
site_dir: docs/site
theme: # https://www.mkdocs.org/user-guide/choosing-your-theme/
# https://squidfunk.github.io/mkdocs-material/
name: material # mkdocs, readthedocs, ...
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/brightness-4
name: Switch to system preference
locale: en
# logo: assets/logo.png
features:
# - navigation.instant
# - navigation.tracking
# - navigation.tabs
# - navigation.tabs.sticky
# - navigation.sections
# - navigation.expand
# - navigation.prune
- navigation.indexes
#- toc.follow
#- toc.integrate
- navigation.top
icon:
note: octicons/tag-16
abstract: octicons/checklist-16
info: octicons/info-16
tip: octicons/squirrel-16
success: octicons/check-16
question: octicons/question-16
warning: octicons/alert-16
failure: octicons/x-circle-16
danger: octicons/zap-16
bug: octicons/bug-16
example: octicons/beaker-16
quote: octicons/quote-16
plugins:
- search
- exclude: # https://github.com/apenwarr/mkdocs-exclude
glob:
#- exclude/this/path/*
- "**/template.md"
- "*.tmp"
- "*.pdf"
- "*.gz"
# regex:
# - '.*\.(tmp|bin|tar)$'
markdown_extensions:
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.critic
- pymdownx.caret
- pymdownx.keys
- pymdownx.mark
- pymdownx.tilde
- plantuml_markdown:
# server: http://www.plantuml.com/plantuml # PlantUML server, for remote rendering
# insecure: False # set to True if the server uses self-signed certificates
# http_method: GET # GET or POST - note that plantuml.com only supports GET (default GET)
# fallback_to_get: True # When using POST, should GET be used as fallback (POST will fail if @startuml/@enduml tags not used) (default True)
cachedir: /tmp # set a non-empty value to enable caching
base_dir: . # where to search for diagrams to include
config: # PlantUML config file, relative to base_dir (a PlantUML file included in every diagram)
encoding: utf-8 # character encoding for external files (default utf-8)
title: UML diagram # default title (tooltip) for diagram images
alt: UML diagram image # default `alt` attribute for diagram images
image_maps: True # generate image maps when the format is png and there are hyperlinks
theme: bluegray # theme to be set, can be overridden inside puml files, (default none)
puml_notheme_cmdlist: [
'version',
'listfonts',
'stdlib',
'license'
]
#!/usr/bin/env sh
set -e
if [ -f "/usr/share/java/plantuml.jar" ]; then
echo '[plantuml] PlantUML already installed.'
exit
fi
echo '[plantuml] Installing PlantUML...'
apk add curl graphviz font-droid font-droid-nonlatin fontconfig
apk add plantuml --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
sed -i 's/java \-jar/java -Djava.awt.headless=true \-jar/' /usr/bin/plantuml
mkdocs==1.4.3
mkdocs-exclude==1.0.2
mkdocs-material==9.1.16
plantuml-markdown==3.9.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment