Skip to content

Commit

Permalink
feat: add convenience targets for working on docs (#2493)
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Rancourt <[email protected]>
  • Loading branch information
krancour authored Sep 9, 2024
1 parent 0e35be5 commit 2933fbf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ IMAGE_PUSH ?= false
IMAGE_PLATFORMS =
DOCKER_BUILD_OPTS =

DOCS_PORT ?= 3000

# Intelligently choose to build a multi-arch image if the intent is to push to a
# container registry (IMAGE_PUSH=true). If not pushing, build an single-arch
# image for the local architecture. Honor IMAGE_PLATFORMS above all.
Expand Down Expand Up @@ -190,15 +192,15 @@ codegen-ui:
# Prevents issues with vcs stamping within docker containers.
GOFLAGS="-buildvcs=false"

DOCKER_CMD := $(CONTAINER_RUNTIME) run \
-it \
DOCKER_OPTS := -it \
--rm \
-e GOFLAGS=$(GOFLAGS) \
-v gomodcache:/home/user/gocache \
-v $(dir $(realpath $(firstword $(MAKEFILE_LIST)))):/workspaces/kargo \
-v /workspaces/kargo/ui/node_modules \
-w /workspaces/kargo \
kargo:dev-tools
-w /workspaces/kargo

DOCKER_CMD := $(CONTAINER_RUNTIME) run $(DOCKER_OPTS) kargo:dev-tools

DEV_TOOLS_BUILD_OPTS =

Expand Down Expand Up @@ -358,3 +360,18 @@ start-controller-local:
KUBECONFIG=~/.kube/config \
ARGOCD_KUBECONFIG=~/.kube/config \
go run ./cmd/controlplane controller

################################################################################
# Docs #
# #
# Convenience targets for building and running the documentation site natively #
# or in a container. #
################################################################################

.PHONY: hack-serve-docs
hack-serve-docs: hack-build-dev-tools
$(CONTAINER_RUNTIME) run $(DOCKER_OPTS) -p $(DOCS_PORT):$(DOCS_PORT) kargo:dev-tools make serve-docs

.PHONY: serve-docs
serve-docs:
cd docs && pnpm install && pnpm start
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "pnpm build-gtag-plugin && docusaurus start",
"start": "pnpm build-gtag-plugin && docusaurus start --host 0.0.0.0",
"build-gtag-plugin": "cd plugins/gtag && pnpm install && pnpm build",
"build": "pnpm build-gtag-plugin && docusaurus build",
"swizzle": "docusaurus swizzle",
Expand Down

0 comments on commit 2933fbf

Please sign in to comment.