forked from compsoc-edinburgh/betterinformatics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-run.sh
30 lines (23 loc) · 879 Bytes
/
docker-run.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
#!/usr/bin/env bash
# Set to the name of the Docker image you want to use
DOCKER_IMAGE_NAME="binf-jekyll"
# Stop on first error
set -e
if [ -e Dockerfile ]; then
# Build a custom Docker image that has custom Jekyll plug-ins installed
docker build --tag $DOCKER_IMAGE_NAME --file Dockerfile .
# Remove dangling images from previous runs
docker rmi -f $(docker images --filter "dangling=true" -q) > /dev/null 2>&1 || true
else
# Use an existing Jekyll Docker image
DOCKER_IMAGE_NAME=grahamc/jekyll
fi
echo "***********************************************************"
echo " Your site will be available at http://localhost:4000"
echo "***********************************************************"
# Start Jekyll and watch for changes
docker run --rm \
--volume=$(pwd):/src:Z \
--publish 4000:4000 \
$DOCKER_IMAGE_NAME \
serve --watch --drafts -H 0.0.0.0