github.com/akerouanton/docker@v1.11.0-rc3/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_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  
    15  # to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
    16  DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR))
    17  
    18  # to allow `make DOCSPORT=9000 docs`
    19  DOCSPORT := 8000
    20  
    21  # Get the IP ADDRESS
    22  DOCKER_IP=$(shell python -c "import urlparse ; print urlparse.urlparse('$(DOCKER_HOST)').hostname or ''")
    23  HUGO_BASE_URL=$(shell test -z "$(DOCKER_IP)" && echo localhost || echo "$(DOCKER_IP)")
    24  HUGO_BIND_IP=0.0.0.0
    25  
    26  GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
    27  DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    28  DOCKER_DOCS_IMAGE := docs-base$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    29  
    30  
    31  DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE
    32  
    33  # for some docs workarounds (see below in "docs-build" target)
    34  GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
    35  
    36  default: docs
    37  
    38  docs: docs-build
    39  	$(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)
    40  
    41  docs-draft: docs-build
    42  	$(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)
    43  
    44  
    45  docs-shell: docs-build
    46  	$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
    47  
    48  
    49  docs-build:
    50  #	( git remote | grep -v upstream ) || git diff --name-status upstream/release..upstream/docs ./ > ./changed-files
    51  #	echo "$(GIT_BRANCH)" > GIT_BRANCH
    52  #	echo "$(AWS_S3_BUCKET)" > AWS_S3_BUCKET
    53  #	echo "$(GITCOMMIT)" > GITCOMMIT
    54  	docker build -t "$(DOCKER_DOCS_IMAGE)" .