build.sh 817 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. set -e
  3. BASE_URL="${BASE_URL:-https://mudler.github.io/edgevpn/}"
  4. binpath="${ROOT_DIR}/bin"
  5. publicpath="${ROOT_DIR}/public"
  6. if [ ! -e "${binpath}/hugo" ];
  7. then
  8. [[ ! -d "${binpath}" ]] && mkdir -p "${binpath}"
  9. wget https://github.com/gohugoio/hugo/releases/download/v"${HUGO_VERSION}"/hugo_extended_"${HUGO_VERSION}"_"${HUGO_PLATFORM}".tar.gz -O "$binpath"/hugo.tar.gz
  10. tar -xvf "$binpath"/hugo.tar.gz -C "${binpath}"
  11. rm -rf "$binpath"/hugo.tar.gz
  12. chmod +x "$binpath"/hugo
  13. fi
  14. rm -rf "${publicpath}" || true
  15. [[ ! -d "${publicpath}" ]] && mkdir -p "${publicpath}"
  16. # Note: It needs
  17. # sudo npm install -g postcss-cli
  18. #
  19. npm install -D --save autoprefixer
  20. npm install -D --save postcss-cli
  21. HUGO_ENV="production" "${binpath}/hugo" --gc -b "${BASE_URL}" -s "${ROOT_DIR}" -d "${publicpath}"