Add HUGO_DESTINATION parameter to allow custom building destination

This commit is contained in:
Alejandro Tabares
2017-09-02 14:29:30 +02:00
parent e79f6d93c7
commit 72fe978bdc
2 changed files with 4 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ Docker image for hugo static page generator (https://gohugo.io)
* `HUGO_THEME`
* `HUGO_WATCH` (set to any value to enable watching)
* `HUGO_DESTINATION` (Path where hugo will render the site. By default `/output`)
* `HUGO_REFRESH_TIME` (in seconds, only applies if not watching, if not set, the container will build once and exit)
* `HUGO_BASEURL`

6
run.sh
View File

@@ -2,6 +2,7 @@
WATCH="${HUGO_WATCH:=false}"
SLEEP="${HUGO_REFRESH_TIME:=-1}"
HUGO_DESTINATION="${HUGO_DESTINATION:=/output}"
echo "HUGO_WATCH:" $WATCH
echo "HUGO_REFRESH_TIME:" $HUGO_REFRESH_TIME
echo "HUGO_THEME:" $HUGO_THEME
@@ -15,10 +16,10 @@ while [ true ]
do
if [[ $HUGO_WATCH != 'false' ]]; then
echo "Watching..."
$HUGO server --watch=true --source="/src" --theme="$HUGO_THEME" --destination="/output" --baseURL="$HUGO_BASEURL" --bind="0.0.0.0" "$@" || exit 1
$HUGO server --watch=true --source="/src" --theme="$HUGO_THEME" --destination="$HUGO_DESTINATION" --baseURL="$HUGO_BASEURL" --bind="0.0.0.0" "$@" || exit 1
else
echo "Building one time..."
$HUGO --source="/src" --theme="$HUGO_THEME" --destination="/output" --baseURL="$HUGO_BASEURL" "$@" || exit 1
$HUGO --source="/src" --theme="$HUGO_THEME" --destination="$HUGO_DESTINATION" --baseURL="$HUGO_BASEURL" "$@" || exit 1
fi
if [[ $HUGO_REFRESH_TIME == -1 ]]; then
@@ -27,4 +28,3 @@ do
echo "Sleeping for $HUGO_REFRESH_TIME seconds..."
sleep $SLEEP
done