Contains the Docker definition and Concourse pipeline for generating a Hugo container image
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
937 B

  1. #!/bin/sh
  2. WATCH="${HUGO_WATCH:=false}"
  3. SLEEP="${HUGO_REFRESH_TIME:=-1}"
  4. HUGO_SOURCE="${HUGO_SOURCE:=/src}"
  5. HUGO_DESTINATION="${HUGO_DESTINATION:=/output}"
  6. echo "HUGO_WATCH:" $WATCH
  7. echo "HUGO_REFRESH_TIME:" $HUGO_REFRESH_TIME
  8. echo "HUGO_THEME:" $HUGO_THEME
  9. echo "HUGO_BASEURL" $HUGO_BASEURL
  10. echo "ARGS" $@
  11. HUGO=/usr/local/sbin/hugo
  12. echo "Hugo path: $HUGO"
  13. while [ true ]
  14. do
  15. if [[ $HUGO_WATCH != 'false' ]]; then
  16. echo "Watching..."
  17. $HUGO server --watch --source "$HUGO_SOURCE" --theme "$HUGO_THEME" --destination "$HUGO_DESTINATION" --baseURL "$HUGO_BASEURL" --bind "0.0.0.0" "$@" || exit 1
  18. else
  19. echo "Building one time..."
  20. $HUGO --source "$HUGO_SOURCE" --theme "$HUGO_THEME" --destination "$HUGO_DESTINATION" --baseURL "$HUGO_BASEURL" "$@" || exit 1
  21. fi
  22. if [[ $HUGO_REFRESH_TIME == -1 ]]; then
  23. exit 0
  24. fi
  25. echo "Sleeping for $HUGO_REFRESH_TIME seconds..."
  26. sleep $SLEEP
  27. done