2019-02-26 16:50:07 +03:00
#######
# This Makefile contains all targets related to the documentation
#######
DOCS_VERIFY_SKIP ?= false
DOCS_LINT_SKIP ?= false
TRAEFIK_DOCS_BUILD_IMAGE ?= traefik-docs
TRAEFIK_DOCS_CHECK_IMAGE ?= $( TRAEFIK_DOCS_BUILD_IMAGE) -check
SITE_DIR := $( CURDIR) /site
DOCKER_RUN_DOC_PORT := 8000
2021-03-16 14:08:04 +03:00
DOCKER_RUN_DOC_MOUNTS := -v $( CURDIR) :/mkdocs
2019-02-26 16:50:07 +03:00
DOCKER_RUN_DOC_OPTS := --rm $( DOCKER_RUN_DOC_MOUNTS) -p $( DOCKER_RUN_DOC_PORT) :8000
# Default: generates the documentation into $(SITE_DIR)
2022-04-15 17:16:08 +03:00
.PHONY : docs
2019-02-26 16:50:07 +03:00
docs : docs -clean docs -image docs -lint docs -build docs -verify
# Writer Mode: build and serve docs on http://localhost:8000 with livereload
2022-04-15 17:16:08 +03:00
.PHONY : docs -serve
2019-02-26 16:50:07 +03:00
docs-serve : docs -image
docker run $( DOCKER_RUN_DOC_OPTS) $( TRAEFIK_DOCS_BUILD_IMAGE) mkdocs serve
2021-03-16 14:08:04 +03:00
## Pull image for doc building
2022-04-15 17:16:08 +03:00
.PHONY : docs -pull -images
2021-03-16 14:08:04 +03:00
docs-pull-images :
2022-04-15 17:16:08 +03:00
grep --no-filename -E '^FROM' ./*.Dockerfile \
| awk '{print $$2}' \
| sort \
| uniq \
| xargs -P 6 -n 1 docker pull
2021-03-16 14:08:04 +03:00
2019-02-26 16:50:07 +03:00
# Utilities Targets for each step
2022-04-15 17:16:08 +03:00
.PHONY : docs -image
2019-02-26 16:50:07 +03:00
docs-image :
docker build -t $( TRAEFIK_DOCS_BUILD_IMAGE) -f docs.Dockerfile ./
2022-04-15 17:16:08 +03:00
.PHONY : docs -build
2019-02-26 16:50:07 +03:00
docs-build : docs -image
docker run $( DOCKER_RUN_DOC_OPTS) $( TRAEFIK_DOCS_BUILD_IMAGE) sh -c " mkdocs build \
&& chown -R $( shell id -u) :$( shell id -g) ./site"
2022-04-15 17:16:08 +03:00
.PHONY : docs -verify
2019-02-26 16:50:07 +03:00
docs-verify : docs -build
2022-04-15 17:16:08 +03:00
i f n e q ( "$(DOCS_VERIFY_SKIP)" , "true" )
docker build -t $( TRAEFIK_DOCS_CHECK_IMAGE) -f check.Dockerfile ./
docker run --rm -v $( CURDIR) :/app $( TRAEFIK_DOCS_CHECK_IMAGE) /verify.sh
e l s e
echo "DOCS_VERIFY_SKIP is true: no verification done."
e n d i f
2019-02-26 16:50:07 +03:00
2022-04-15 17:16:08 +03:00
.PHONY : docs -lint
2019-02-26 16:50:07 +03:00
docs-lint :
2022-04-15 17:16:08 +03:00
i f n e q ( "$(DOCS_LINT_SKIP)" , "true" )
docker build -t $( TRAEFIK_DOCS_CHECK_IMAGE) -f check.Dockerfile ./
docker run --rm -v $( CURDIR) :/app $( TRAEFIK_DOCS_CHECK_IMAGE) /lint.sh
e l s e
echo "DOCS_LINT_SKIP is true: no linting done."
e n d i f
2019-02-26 16:50:07 +03:00
2022-04-15 17:16:08 +03:00
.PHONY : docs -clean
2019-02-26 16:50:07 +03:00
docs-clean :
rm -rf $( SITE_DIR)