-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·29 lines (24 loc) · 846 Bytes
/
build
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
#!/bin/bash
cd "$(dirname "$0")"
function finish {
[ -d resources ] && rm -r resources
[ -d content/docs/ ] && rm -rf content/docs/
[ -d static/docs ] && rm -rf static/docs
[ -d data/docs ] && rm -rf data/docs
find . -name __pycache__ -type d -prune -execdir rm -rf __pycache__ ';'
rmdir * 2> /dev/null
}
trap finish EXIT QUIT ABRT KILL SEGV TERM STOP
finish
[ -d public ] && rm -rf public/*
IMG=klakegg/hugo:0.101.0-ext-alpine
if [ "$1" = 'server' ]
then
DOCKER_ARGS="${DOCKER_ARGS} -p 1313:1313 -t"
HUGO_ARGS="server --disableFastRender -p 1313 -b http://localhost/"
else
DOCKER_ARGS="-e HUGO_ENV=production"
# IMG="${IMG}-ci"
fi
python3 doxml/dumper.py dox/combined.xml .
docker run ${DOCKER_ARGS} --ulimit nofile=5000:5000 "-u$(id -u):$(id -g)" -v /etc/passwd:/etc/passwd --rm -i -v "$(pwd):/src" "$IMG" ${HUGO_ARGS}