-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathdocker_build.sh
More file actions
executable file
·46 lines (41 loc) · 1.26 KB
/
docker_build.sh
File metadata and controls
executable file
·46 lines (41 loc) · 1.26 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
#!/bin/bash
# Build and/or serve the site locally using the JBake Docker image
function fatal() {
echo $* >&2
exit 1
}
# N.B. jbake-docker.properties defines server.hostname=0.0.0.0
# This is necessary to ensure the server accepts external requests
# (The documentation says to use localhost, but that does not work)
OPT=$1
shift
case "$OPT" in
-s)
# just serve the site
docker run --rm \
-u jbake \
-v "$PWD":/mnt/site \
-e 'JBAKE_OPTS="-Djavax.xml.accessExternalDTD=http,https"' \
-p '8820:8820' \
jbake/jbake:latest -c jbake-docker.properties -s || fatal "Build failed, exiting"
;;
-bs)
# bake and serve the site
docker run --rm \
-u jbake \
-v "$PWD":/mnt/site \
-e 'JBAKE_OPTS="-Djavax.xml.accessExternalDTD=http,https"' \
-p '8820:8820' \
jbake/jbake:latest -c jbake-docker.properties -b -s || fatal "Build failed, exiting"
;;
-b)
# just bake the site
docker run --rm \
-u jbake \
-v "$PWD":/mnt/site \
-e 'JBAKE_OPTS="-Djavax.xml.accessExternalDTD=http,https"' \
jbake/jbake:latest "$@" || fatal "Build failed, exiting"
;;
*) echo "Valid options are: -b (bake), -s (serve), -bs (bake and serve)"
;;
esac