Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit test-integration test-integration-cli validate
  2. # to allow `make BINDDIR=. shell` or `make BINDDIR= test`
  3. BINDDIR := bundles
  4. # to allow `make DOCSPORT=9000 docs`
  5. DOCSPORT := 8000
  6. GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
  7. DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH))
  8. DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
  9. DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/dotcloud/docker/$(BINDDIR)")
  10. DOCKER_RUN_DOCKER := docker run --rm -it --privileged -e TESTFLAGS -e TESTDIRS -e DOCKER_GRAPHDRIVER -e DOCKER_EXECDRIVER $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
  11. # to allow `make DOCSDIR=docs docs-shell`
  12. DOCKER_RUN_DOCS := docker run --rm -it $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) -e AWS_S3_BUCKET
  13. default: binary
  14. all: build
  15. $(DOCKER_RUN_DOCKER) hack/make.sh
  16. binary: build
  17. $(DOCKER_RUN_DOCKER) hack/make.sh binary
  18. cross: build
  19. $(DOCKER_RUN_DOCKER) hack/make.sh binary cross
  20. docs: docs-build
  21. $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve
  22. docs-shell: docs-build
  23. $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
  24. docs-release: docs-build
  25. $(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./release.sh
  26. test: build
  27. $(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration test-integration-cli
  28. test-unit: build
  29. $(DOCKER_RUN_DOCKER) hack/make.sh test-unit
  30. test-integration: build
  31. $(DOCKER_RUN_DOCKER) hack/make.sh test-integration
  32. test-integration-cli: build
  33. $(DOCKER_RUN_DOCKER) hack/make.sh binary test-integration-cli
  34. validate: build
  35. $(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco
  36. shell: build
  37. $(DOCKER_RUN_DOCKER) bash
  38. build: bundles
  39. docker build -t "$(DOCKER_IMAGE)" .
  40. docs-build:
  41. cp ./VERSION docs/VERSION
  42. echo "$(GIT_BRANCH)" > docs/GIT_BRANCH
  43. echo "$(AWS_S3_BUCKET)" > docs/AWS_S3_BUCKET
  44. docker build -t "$(DOCKER_DOCS_IMAGE)" docs
  45. bundles:
  46. mkdir bundles