github.com/a4a881d4/docker@v1.9.0-rc2/docs/Makefile (about) 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 3 # env vars passed through directly to Docker's build scripts 4 # to allow things like `make DOCKER_CLIENTONLY=1 binary` easily 5 # `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these 6 DOCKER_ENVS := \ 7 -e BUILDFLAGS \ 8 -e DOCKER_CLIENTONLY \ 9 -e DOCKER_EXECDRIVER \ 10 -e DOCKER_GRAPHDRIVER \ 11 -e TESTDIRS \ 12 -e TESTFLAGS \ 13 -e TIMEOUT 14 # 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 15 16 # to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs) 17 DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR)) 18 19 # to allow `make DOCSPORT=9000 docs` 20 DOCSPORT := 8000 21 22 # Get the IP ADDRESS 23 DOCKER_IP=$(shell python -c "import urlparse ; print urlparse.urlparse('$(DOCKER_HOST)').hostname or ''") 24 HUGO_BASE_URL=$(shell test -z "$(DOCKER_IP)" && echo localhost || echo "$(DOCKER_IP)") 25 HUGO_BIND_IP=0.0.0.0 26 27 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) 28 DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 29 DOCKER_DOCS_IMAGE := docs-base$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 30 31 32 DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE 33 34 # for some docs workarounds (see below in "docs-build" target) 35 GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null) 36 37 default: docs 38 39 docs: docs-build 40 $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" hugo server --port=$(DOCSPORT) --baseUrl=$(HUGO_BASE_URL) --bind=$(HUGO_BIND_IP) 41 42 docs-draft: docs-build 43 $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 -e DOCKERHOST "$(DOCKER_DOCS_IMAGE)" hugo server --buildDrafts="true" --port=$(DOCSPORT) --baseUrl=$(HUGO_BASE_URL) --bind=$(HUGO_BIND_IP) 44 45 46 docs-shell: docs-build 47 $(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash 48 49 50 docs-build: 51 # ( git remote | grep -v upstream ) || git diff --name-status upstream/release..upstream/docs ./ > ./changed-files 52 # echo "$(GIT_BRANCH)" > GIT_BRANCH 53 # echo "$(AWS_S3_BUCKET)" > AWS_S3_BUCKET 54 # echo "$(GITCOMMIT)" > GITCOMMIT 55 docker build -t "$(DOCKER_DOCS_IMAGE)" .