-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdockerdocs
More file actions
executable file
·84 lines (78 loc) · 2.86 KB
/
Copy pathdockerdocs
File metadata and controls
executable file
·84 lines (78 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env bash
#
# dockerdocs — Pramnos Framework documentation CLI
#
# Runs MkDocs Material commands inside the Docker container so that no local
# Python or pip installation is required on the host machine.
#
# Usage:
# ./dockerdocs serve — Start the live-reload dev server on localhost:8000
# ./dockerdocs build — Build the static HTML site into site/
# ./dockerdocs deploy — Build and push to GitHub Pages (gh-deploy)
# ./dockerdocs <cmd> — Pass any mkdocs sub-command directly
set -euo pipefail
COMMAND="${1:-serve}"
shift || true
# Sync brand assets (logo + favicon) from the single source of truth in brand/
# into docs/assets/ so the site always builds with the current artwork. The
# copies under docs/assets/ are git-ignored and regenerated here on every run.
# The GitHub Pages workflow performs the same copy before its build step.
sync_brand_assets() {
local root logo favicon
root="$(pwd)"
logo="$root/brand/logos/pramnos-logo-wide-inverse.png" # light ink — reads on the indigo header
favicon="$root/brand/favicons/favicon-32x32.png"
if [ -f "$logo" ] && [ -f "$favicon" ]; then
mkdir -p "$root/docs/assets"
cp "$logo" "$root/docs/assets/logo.png"
cp "$favicon" "$root/docs/assets/favicon.png"
echo "Synced brand assets → docs/assets/ (logo.png, favicon.png)"
else
echo "WARNING: brand assets not found; docs will build without logo/favicon." >&2
fi
}
case "$COMMAND" in
serve|build|deploy)
sync_brand_assets
;;
esac
# Ensure the docs container image is available
if ! docker image inspect squidfunk/mkdocs-material:latest >/dev/null 2>&1; then
echo "Pulling squidfunk/mkdocs-material image..."
docker pull squidfunk/mkdocs-material:latest
fi
case "$COMMAND" in
serve)
echo "Starting MkDocs development server at http://localhost:8000 ..."
echo "Press Ctrl+C to stop."
docker run --rm -it \
-p 8000:8000 \
-v "$(pwd)":/docs \
squidfunk/mkdocs-material:latest \
serve -f mkdocs.local.yml --dev-addr=0.0.0.0:8000 "$@"
;;
build)
echo "Building documentation site into site/ ..."
docker run --rm \
-v "$(pwd)":/docs \
squidfunk/mkdocs-material:latest \
build "$@"
echo "Done. Static files are in ./site/"
;;
deploy)
echo "Deploying documentation to GitHub Pages ..."
docker run --rm -it \
-v "$(pwd)":/docs \
-v "$HOME/.ssh":/root/.ssh:ro \
squidfunk/mkdocs-material:latest \
gh-deploy --force "$@"
echo "Deployed."
;;
*)
# Pass-through any other mkdocs sub-command
docker run --rm -it \
-v "$(pwd)":/docs \
squidfunk/mkdocs-material:latest \
"$COMMAND" "$@"
;;
esac