-
Notifications
You must be signed in to change notification settings - Fork 4
/
_develop-site.sh
executable file
·58 lines (47 loc) · 1.77 KB
/
_develop-site.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
56
57
58
#! /bin/bash
#
# helper, so you don't need to remember docker-compose syntax...
# some colors to highlight certain output
GREEN=`tput setaf 2`
RED=`tput setaf 5`
RESET=`tput sgr0`
clear
echo
echo "Docker container to develop or build this website:"
echo "=================================================="
echo
echo "Please select wether to ${GREEN}develop ${RESET} or ${RED} build ${RESET} the site:"
echo
echo "${GREEN}(d)evelop ${RESET} starts a jekyll server on port 0.0.0.0:4000,"
echo "which performs incremental builds and listens for file changes."
echo
echo "${GREEN}(b)build ${RESET} build the required docker image."
echo
echo "${RED}(p)production ${RESET} produces the site with production configuration,"
echo "into ./zz-site directory."
echo "This option is currently NOT USEFUL, as the site is published"
echo "via github-pages to a custom domain."
echo "=================================================="
echo
read -p "Enter your selection (default: develop, d) : " choice
if [[ -z $choice ]]; then
choice='develop'
fi
case "$choice" in
b|B|build) echo "build Docker image"
docker-compose --file _docker-compose-dev.yml build --force-rm
;;
d|D|dev|develop) echo "develop, incremental build"
docker-compose --file _docker-compose-dev.yml up
docker-compose --file _docker-compose-dev.yml down
;;
p|P|production) echo "create production site"
docker-compose --file _docker-compose-prod.yml up
docker-compose --file _docker-compose-prod.yml down
;;
# catchall: abort
*) echo "${RED} unknown option $choice ${RESET}, aborted."
exit 1
;;
esac
echo "Thanx."