-
Notifications
You must be signed in to change notification settings - Fork 45
/
docker_build.sh
executable file
·43 lines (39 loc) · 1.24 KB
/
docker_build.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
#!/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)
case "$1" 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