-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·49 lines (44 loc) · 1.03 KB
/
entrypoint.sh
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
#! /bin/sh
produce_help(){
echo "Mount your mkdocs folder to '/mkdocs/project'"
echo "Example:"
echo "docker run -v \"/path/to/your/mkdocs/project:/mkdocs/project\" " \
"mkdocs produce > my_project.tar.gz "
}
produce() {
# Uses a predetermined folder 'project' and
# builds + compresses the mkdocs project to stdout
cd project
mkdocs build
tar czf - .
}
serve_help(){
echo "Use a compressed mkdocs project and map port 8000 to 8000"
echo "Example:"
echo "cat my_project.tar.gz | docker run --rm -p 8000:8000 -i mkdocs serve"
}
serve() {
# Uses a compressed mkdocs project from stdin and serves it port 8000
mkdir /opt/www
tar xzf - -C /opt/www
cd /opt/www
mkdocs serve -a 0.0.0.0:8000
}
get_help() {
echo "You can either produce or serve a mkdocs project"
echo "\nProduce help:"
produce_help
echo "\nServe help:"
serve_help
}
case $1 in
produce)
produce
;;
serve)
serve
;;
*)
get_help
;;
esac