forked from arc42/arc42.org-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_manage-site.sh
executable file
·78 lines (64 loc) · 2.3 KB
/
_manage-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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#! /bin/bash
#
# helper, so you don't need to remember docker-compose syntax...
# what's the site?
site="arc42.org"
server="wp1063700.server-he.de"
localdir="zz-production-site"
remotedir="."
# some colors to highlight certain output
GREEN=`tput setaf 2`
RED=`tput setaf 5`
BLUE=`tput setaf 6`
RESET=`tput sgr0`
clear
echo
echo "Docker container to develop or build the ${BLUE}$site ${RESET}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 "${GREEN}(r)emove ${RESET} the running docker container."
echo
echo "${RED}(p)production ${RESET} produces the site with production configuration,"
echo "into ./zz-production-site directory."
echo
#echo "${GREEN}(u)pload ${RESET} the generated site to $server/$remotedir "
#echo
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
;;
r|R|remove) echo "remove running docker container"
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
;;
# u|U|upload) echo "upload generated site to server"
# docker run -it \
# --volume $PWD/$localdir:/$localdir \
# ftp-uploader:0.2.4 \
# $site $server $localdir $remotedir
# ;;
# catchall: abort
*) echo "${RED} unknown option $choice ${RESET}, aborted."
exit 1
;;
esac
echo "Thanx."