-
Notifications
You must be signed in to change notification settings - Fork 670
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(monodocs): Add script for building docs for flytekit and flytectl
Signed-off-by: Chi-Sheng Liu <[email protected]>
- Loading branch information
1 parent
ae93ed3
commit 81fd331
Showing
3 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
# Available environment variables | ||
# - DEV_DOCS_WATCH: If set, the docs will be built and served using sphinx-autobuild for live updates | ||
# - FLYTEKIT_LOCAL_PATH: If set, the local path to flytekit will be used instead of the source code from the flyteorg/flytekit repo | ||
# - FLYTECTL_LOCAL_PATH: If set, the local path to flytectl will be used instead of the source code from the flyteorg/flytectl repo | ||
# | ||
# Example usages: | ||
# ./script/local_build_docs.sh | ||
# DEV_DOCS_WATCH=1 ./script/local_build_docs.sh | ||
# FLYTEKIT_LOCAL_PATH=$(realpath ../flytekit) ./script/local_build_docs.sh | ||
|
||
DOCKER_ENV=() | ||
DOCKER_VOLUME_MAPPING=("-v" "./docs:/docs") | ||
DOCKER_PORT_MAPPING=() | ||
BUILD_CMD=("sphinx-build" "-M" "html" "." "_build") | ||
|
||
if [ -n "$DEV_DOCS_WATCH" ]; then | ||
DOCKER_PORT_MAPPING+=("-p" "8000:8000") | ||
BUILD_CMD=("sphinx-autobuild" "--host" "0.0.0.0" "--re-ignore" "'_build|_src|_tags|api|examples|flytectl|flytekit|flytesnacks|protos|tests'" "." "_build/html") | ||
fi | ||
|
||
if [ -n "$FLYTEKIT_LOCAL_PATH" ]; then | ||
DOCKER_VOLUME_MAPPING+=("-v" "$FLYTEKIT_LOCAL_PATH:/flytekit") | ||
DOCKER_ENV+=("--env" "FLYTEKIT_LOCAL_PATH=/flytekit") | ||
fi | ||
|
||
if [ -n "$FLYTECTL_LOCAL_PATH" ]; then | ||
DOCKER_VOLUME_MAPPING+=("-v" "$FLYTECTL_LOCAL_PATH:/flytectl") | ||
DOCKER_ENV+=("--env" "FLYTECTL_LOCAL_PATH=/flytectl") | ||
fi | ||
|
||
DOCKER_CMD=("docker" "run" "--rm" "--pull" "never" "${DOCKER_ENV[@]}" "${DOCKER_PORT_MAPPING[@]}" "${DOCKER_VOLUME_MAPPING[@]}" "flyte-dev-docs:latest" "${BUILD_CMD[@]}") | ||
|
||
echo "${DOCKER_CMD[*]}" | ||
|
||
"${DOCKER_CMD[@]}" |