Skip to content

Commit

Permalink
feat(monodocs): Add sphinx-autobuild to Makefile
Browse files Browse the repository at this point in the history
Signed-off-by: Chi-Sheng Liu <[email protected]>
  • Loading branch information
MortalHappiness committed Feb 29, 2024
1 parent 13c43c5 commit 0f1fb69
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Dockerfile.docs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ RUN --mount=type=bind,source=monodocs-environment.lock.yaml,target=monodocs-envi
ENV SETUPTOOLS_SCM_PRETEND_VERSION 2.0.0
COPY flyteidl flyteidl
SHELL ["conda", "run", "-n", "monodocs-env", "/bin/bash", "-c"]
RUN python -m pip install sphinx-autobuild
RUN python -m pip install ./flyteidl

WORKDIR /docs
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "monodocs-env", "sphinx-build"]
WORKDIR docs
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "monodocs-env"]
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,25 @@ helm_install: ## Install helm charts
helm_upgrade: ## Upgrade helm charts
helm upgrade flyte --debug ./charts/flyte -f ./charts/flyte/values.yaml --create-namespace --namespace=flyte

# Used in CI
.PHONY: docs
docs:
make -C docs clean html SPHINXOPTS=-W

# Used in local development
.PHONY: build-dev-docs-image
build-dev-docs-image:
docker buildx build -t flyte-dev-docs:latest -f Dockerfile.docs .

# Build docs in docker container for local development
.PHONY: dev-docs-build
dev-docs-build: build-dev-docs-image
docker run --rm --pull never -v ./docs:/docs --user $$(id -u):$$(id -g) flyte-dev-docs:latest sphinx-build -M html . _build

# Build docs in docker container for local development with hot-reload
.PHONY: dev-docs
dev-docs:
docker run --rm --pull never -v ./docs:/docs flyte-dev-docs:latest -M html . _build
dev-docs: build-dev-docs-image
docker run --rm --pull never -p 8000:8000 -v ./docs:/docs --user $$(id -u):$$(id -g) flyte-dev-docs:latest sphinx-autobuild --host 0.0.0.0 --re-ignore '_build|_src|_tags|api|examples|flytectl|flytekit|flytesnacks|protos|tests' . ./_build/html

.PHONY: help
help: SHELL := /bin/sh
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ help:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
rm -rf _build _src api flytectl flytekit flytesnacks protos examples
rm -rf _build _src _tags api flytectl flytekit flytesnacks protos examples tests

0 comments on commit 0f1fb69

Please sign in to comment.