Files
VictoriaMetrics/docs/Makefile
Aliaksandr Valialkin a93ff1a6ec docs/Makefile: move the comments for make docs-images-to-webp command into the correct place
The comments weren't moved to the correct place in the commit 36bc458e9e

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6825

P.S. it was a strange decision to use a bloated docker image from VictoriaMetrics/vmdocs repository
for the conversion of the `*.png` files to `*.webp` files instead of the specialized slim image - https://hub.docker.com/r/elswork/cwebp .
2025-07-06 19:55:55 +02:00

55 lines
1.8 KiB
Makefile

UID := "$(shell id -u)"
PLATFORM := $(shell uname -m)
DOCKER_PLATFORM := "linux/$(if $(findstring $(PLATFORM),arm64),arm64,amd64)"
# These commands must be run from the VictoriaMetrics repository root
docs-image:
if [ ! -d vmdocs ]; then \
git clone --depth 1 git@github.com:VictoriaMetrics/vmdocs vmdocs; \
fi; \
cd vmdocs && \
git checkout main && \
git pull origin main && \
cd .. && \
docker build \
-t vmdocs-docker-package \
--build-arg UID=$(UID) \
--platform $(DOCKER_PLATFORM) \
vmdocs
docs-debug: docs docs-image
docker run \
--rm \
--name vmdocs-docker-container \
--platform $(DOCKER_PLATFORM) \
-p 1313:1313 \
$(foreach dir,$(wildcard ./docs/$(dir)/*), -v ./docs/$(notdir $(dir)):/opt/docs/content/$(notdir $(dir))) \
vmdocs-docker-package
docs-update-version: docs-image
$(if $(filter v%,$(PKG_TAG)), \
docker run \
--rm \
--entrypoint /usr/bin/find \
--platform $(DOCKER_PLATFORM) \
--name vmdocs-docker-container \
-v ./docs:/opt/docs/content/victoriametrics vmdocs-docker-package \
content \
-regex ".*\.md" \
-exec sed -i 's/{{% available_from "#" %}}/{{% available_from "$(PKG_TAG)" %}}/g' {} \;, \
$(info "Skipping docs version update, invalid $$PKG_TAG: $(PKG_TAG)"))
# Converts images at docs folder to webp format
# See https://docs.victoriametrics.com/victoriametrics/single-server-victoriametrics/#images-in-documentation
docs-images-to-webp: docs-image
docker run \
--rm \
--platform $(DOCKER_PLATFORM) \
--entrypoint /usr/bin/find \
--name vmdocs-docker-container \
-v ./docs:/opt/docs/content/victoriametrics vmdocs-docker-package \
content \
-regex ".*\.\(png\|jpg\|jpeg\)" \
-exec sh -c 'cwebp -preset drawing -m 6 -o $$(echo {} | cut -f-1 -d.).webp {} && rm -rf {}' {} \;