Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit test-integration test-integration-cli test-docker-py validate
  2. # env vars passed through directly to Docker's build scripts
  3. # to allow things like `make DOCKER_CLIENTONLY=1 binary` easily
  4. # `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these
  5. DOCKER_ENVS := \
  6. -e BUILDFLAGS \
  7. -e DOCKER_CLIENTONLY \
  8. -e DOCKER_EXECDRIVER \
  9. -e DOCKER_GRAPHDRIVER \
  10. -e TESTDIRS \
  11. -e TESTFLAGS \
  12. -e TIMEOUT
  13. # note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds
  14. # to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
  15. DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR))
  16. # to allow `make DOCSPORT=9000 docs`
  17. DOCSPORT := 8180
  18. GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
  19. DOCKER_DOCS_IMAGE := grafana-docs-base$(if $(GIT_BRANCH),:$(GIT_BRANCH))
  20. DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE
  21. # for some docs workarounds (see below in "docs-build" target)
  22. GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
  23. default: docs
  24. docs: docs-build
  25. $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve
  26. docs-shell: docs-build
  27. $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
  28. docs-release: docs-build
  29. $(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT -e DISTRIBUTION_ID \
  30. -v $(CURDIR)/awsconfig:/docs/awsconfig \
  31. "$(DOCKER_DOCS_IMAGE)" ./release.sh
  32. docs-test: docs-build
  33. $(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./test.sh
  34. docs-build:
  35. docker build -t "$(DOCKER_DOCS_IMAGE)" .