docs/Makefile: simplify and document make docs-debug after ce4cc4cbb2

- Document `make docs-debug` command at https://docs.victoriametrics.com/#documentation

- Remove unneeded ROOTDIR, REPODIR and WORKDIR env vars from docs/Makefile ,
  since it is documented and expected that all the Makefile commands are run from the repository root.

- Use `docker --rm` for running Docker container with local docs server, so it is automatically
  removed after pressing `Ctrl+C`. This makes the container cleanup automatic.

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6677
This commit is contained in:
Aliaksandr Valialkin 2024-07-25 13:12:01 +02:00
parent a135a4dcfa
commit f320efd5ad
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -1,7 +1,3 @@
ROOTDIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
REPODIR := $(ROOTDIR)/..
WORKDIR := $(REPODIR)/..
# These commands must be run from the VictoriaMetrics repository root
# Converts images at docs folder to webp format
@ -20,19 +16,18 @@ docs-images-to-webp-by-extension:
find docs/ -type f ! -path 'docs/operator/*' ! -path 'docs/_site/*' -name '*.$(IMAGES_EXTENSION)' -print0 | xargs -0 rm -f
docs-debug:
if [ ! -d $(WORKDIR)/vmdocs ]; then \
git clone git@github.com:VictoriaMetrics/vmdocs $(WORKDIR)/vmdocs; \
if [ ! -d vmdocs ]; then \
git clone --depth 1 git@github.com:VictoriaMetrics/vmdocs vmdocs; \
fi; \
cd $(WORKDIR)/vmdocs && \
cd vmdocs && \
git checkout main && \
git pull origin main && \
cd $(REPODIR) && \
cd .. && \
docker build \
-t vmdocs \
$(WORKDIR)/vmdocs && \
docker rm -f vmdocs || true && \
-t vmdocs-docker-package \
vmdocs && \
docker run \
-d \
--name vmdocs \
--rm \
--name vmdocs-docker-container \
-p 1313:1313 \
-v ./docs:/opt/docs/content vmdocs
-v ./docs:/opt/docs/content vmdocs-docker-package