forked from bcgov/bootstrap-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jekyll-docker.sh
executable file
·56 lines (45 loc) · 1.06 KB
/
jekyll-docker.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
50
51
52
53
54
55
#!/usr/bin/env sh
usage () {
cat <<-EOF
Usage: $0 [command] [options]
Commands:
serve - Build the demonstration site and serve it on port 9001, recompiling
automatically as changes are detected.
compile - Build the demonstration site.
run - Run an arbitrary jekyll command.
clean - Remove compiled files and temporary docker volumes.
EOF
}
run () {
DOCKER=${DOCKER:-docker}
if ! which $DOCKER > /dev/null; then
echo Docker executable not found
exit 1
fi
$DOCKER run --rm -it --name=bootstrap-theme-jekyll \
-v $(pwd):/srv/jekyll -v bst-jekyll-bundle:/usr/local/bundle \
-p 4000:4000 -p 9001:9001 jekyll/jekyll:3.7 jekyll $@
}
COMMAND="$1"
shift || COMMAND=usage
case "${COMMAND}" in
compile)
run build
;;
serve)
echo "Running server ..."
run serve --incremental
;;
run)
run $@
;;
clean)
for VOLUME in bst-jekyll-bundle; do
docker volume inspect $VOLUME &> /dev/null && docker volume rm $VOLUME
done
rm -Rf _gh_pages
echo "Removed generated files and docker volumes"
;;
*)
usage
esac