diff --git a/hack/tfw.sh b/hack/tfw.sh index f683a5f..dad09a4 100755 --- a/hack/tfw.sh +++ b/hack/tfw.sh @@ -5,6 +5,7 @@ set -o errtrace shopt -s expand_aliases [ "$(uname)" == "Darwin" ] && alias readlink="greadlink" || : +here="$(pwd)" SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" TAO_PATH="${TAO_PATH:-$SCRIPT_DIR/../..}" BASEIMAGE_REPO="${BASEIMAGE_REPO:-baseimage-tutorial-framework}" @@ -150,6 +151,28 @@ start_test() wait } +build_docs() +{ + mount_point="/mnt/docs" + + docker run --rm \ + -ti \ + -v "$BASEIMAGE_PATH"/docs:"$mount_point" \ + "$BASEIMAGE_NAME" \ + /bin/bash -c \ + "cd $mount_point + pip3 install sphinx + make html + exit" \ + &> /dev/null + + if [ "$?" == "0" ]; then + echo "Built baseimage docs at ${BASEIMAGE_PATH}/docs/build/html!" + else + echo "Building baseimage docs failed!" + fi +} + case ${1:-} in start) RUN_FRONTEND=1 start_test ${@:2} @@ -175,6 +198,9 @@ case ${1:-} in releasetfw) release_baseimage ;; + builddocs) + build_docs + ;; *) echo "Usage: tfw.sh [start|buildtfw|build|buildwithfrontend|releasetfw]" echo " |--- start: build & run TFW test and Angular frontend" @@ -185,5 +211,6 @@ case ${1:-} in echo " |--- build: build TFW baseimage and test" echo " |--- buildwithfrontend: build TFW baseimage and test, include frontend in image" echo " |--- releasetfw: tag TFW baseimage and push to upstream" + echo " |--- builddocs: build baseimage documentation (in docs/build/html)" ;; esac