Commit 1588d723 by Kyle Brandt Committed by GitHub

Docs: include Makefile option for local assets (#30455)

for use when also having the website repo checked out, and you want local images.
Also make vars for some of the repeated items.
parent 5c8d662b
.PHONY: docs docs-no-pull docs-test .PHONY: docs docs-no-pull docs-test docs-local-static
IMAGE = grafana/grafana-docs-dev:latest IMAGE = grafana/grafana-docs-dev:latest
CONTENT_PATH = /hugo/content/docs/grafana/latest
LOCAL_STATIC_PATH = ../../website/static
PORT = 3002:3002
docs: docs:
docker pull $(IMAGE) docker pull $(IMAGE)
docker run -v $(shell pwd)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it $(IMAGE) docker run -v $(shell pwd)/sources:$(CONTENT_PATH) -p $(PORT) --rm -it $(IMAGE)
docs-no-pull: docs-no-pull:
docker run -v $(shell pwd)/sources:/hugo/content/docs/grafana/latest -p 3002:3002 --rm -it $(IMAGE) docker run -v $(shell pwd)/sources:$(CONTENT_PATH) -p $(PORT) --rm -it $(IMAGE)
docs-test: docs-test:
docker pull $(IMAGE) docker pull $(IMAGE)
docker run -v $(shell pwd)/sources:/hugo/content/docs/grafana/latest --rm -it $(IMAGE) /bin/bash -c 'make prod' docker run -v $(shell pwd)/sources:$(CONTENT_PATH) --rm -it $(IMAGE) /bin/bash -c 'make prod'
\ No newline at end of file
# expects that you have grafana/website checked out in same path as the grafana repo.
docs-local-static:
docker pull $(IMAGE)
if [ ! -d "$(LOCAL_STATIC_PATH)" ]; then echo "local path (website project) $(LOCAL_STATIC_PATH) not found"]; exit 1; fi
docker run -v $(shell pwd)/sources:$(CONTENT_PATH) \
-v $(shell pwd)/$(LOCAL_STATIC_PATH):/hugo/static -p $(PORT) --rm -it $(IMAGE)
\ No newline at end of file
...@@ -12,6 +12,8 @@ Yarn >= 1.22.4 ...@@ -12,6 +12,8 @@ Yarn >= 1.22.4
1. On the command line, first change to the docs folder: `cd docs`. 1. On the command line, first change to the docs folder: `cd docs`.
1. Run `make docs`. This launches a preview of the docs website at `http://localhost:3002/docs/grafana/latest/` which will refresh automatically when changes are made to content in the `sources` directory. 1. Run `make docs`. This launches a preview of the docs website at `http://localhost:3002/docs/grafana/latest/` which will refresh automatically when changes are made to content in the `sources` directory.
If you have the grafana/website repo checked out in the same directory as the grafana repo, then you can run `make docs-local-static` to use local assets (such as images).
--- ---
## Content guidelines ## Content guidelines
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment