2017-04-27 05:17:22 -05:00
|
|
|
.PHONY: all default docs docs-build docs-shell shell checkvars
|
2015-03-10 02:55:42 -05:00
|
|
|
|
|
|
|
# to allow `make DOCSPORT=9000 docs`
|
2016-10-21 04:01:34 -05:00
|
|
|
DOCSPORT := 3004
|
|
|
|
|
|
|
|
DOCKER_DOCS_IMAGE := grafana/grafana-docs
|
|
|
|
SOURCES_HOST_DIR := "$(shell pwd)/sources"
|
2015-03-10 02:55:42 -05:00
|
|
|
|
2019-06-12 01:01:44 -05:00
|
|
|
# assuming grafana and grafana.org-repo to be checked out in the same folder
|
|
|
|
DEFAULT_LAYOUTS_DIR := "$(shell pwd)/../../../../../../grafana.org/layouts"
|
|
|
|
|
|
|
|
# to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
|
|
|
|
LAYOUTS_MOUNT := $(if $(LAYOUTS),-v $(DEFAULT_LAYOUTS_DIR):/site/layouts)
|
2017-02-07 05:27:16 -06:00
|
|
|
DOCS_MOUNT := -v $(SOURCES_HOST_DIR):/site/content
|
2017-02-07 02:09:51 -06:00
|
|
|
|
2019-06-12 01:01:44 -05:00
|
|
|
DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) $(LAYOUTS_MOUNT) -e NOCACHE -p 3004:3004 -p 3005:3005
|
2017-02-07 02:09:51 -06:00
|
|
|
|
2017-04-27 05:17:22 -05:00
|
|
|
VERSION := $(shell head -n 1 VERSION)
|
2015-03-10 02:55:42 -05:00
|
|
|
|
|
|
|
default: docs
|
|
|
|
|
2017-04-27 05:17:22 -05:00
|
|
|
checkvars:
|
|
|
|
ifndef ENV
|
|
|
|
$(error ENV is undefined set via ENV=staging or ENV=prod as argument to make)
|
|
|
|
endif
|
|
|
|
|
2015-03-10 02:55:42 -05:00
|
|
|
docs: docs-build
|
2017-02-07 05:27:16 -06:00
|
|
|
$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "grunt --env=dev-docs && grunt connect --port=3004"
|
2016-10-21 04:01:34 -05:00
|
|
|
|
2017-04-27 05:17:22 -05:00
|
|
|
watch: docs-build
|
2019-06-12 01:01:44 -05:00
|
|
|
$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) $(LAYOUTS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "grunt --env=dev-docs && grunt connect --port=3004 & grunt watch --port=3004 --env=dev-docs"
|
2016-10-21 04:01:34 -05:00
|
|
|
|
2017-04-27 05:17:22 -05:00
|
|
|
publish: checkvars docs-build
|
|
|
|
$(info Publishing ENV=${ENV} and VERSION=${VERSION})
|
|
|
|
$(DOCKER_RUN_DOCS) $(DOCS_MOUNT) -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" /bin/bash -c "./publish.sh ${ENV}-docs ${VERSION}"
|
2015-03-10 02:55:42 -05:00
|
|
|
|
|
|
|
docs-build:
|
2017-02-07 02:09:51 -06:00
|
|
|
docker build -t "$(DOCKER_DOCS_IMAGE)" --no-cache .
|