mirror of
https://github.com/jojomi/docker-hugo.git
synced 2022-05-08 23:14:41 +03:00
Add HUGO_DESTINATION parameter to allow custom building destination
This commit is contained in:
@@ -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
6
run.sh
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user