github.com/nguyentm83/docker@v1.5.0/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 BINDDIR=. shell` or `make BINDDIR= test`
    17  # (default to no bind mount if DOCKER_HOST is set)
    18  BINDDIR := $(if $(DOCKER_HOST),,bundles)
    19  DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/docker/docker/$(BINDDIR)")
    20  
    21  # to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
    22  DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR))
    23  
    24  # to allow `make DOCSPORT=9000 docs`
    25  DOCSPORT := 8000
    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 := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    30  
    31  DOCKER_RUN_DOCKER := docker run --rm -it --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
    32  
    33  DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE
    34  
    35  # for some docs workarounds (see below in "docs-build" target)
    36  GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
    37  
    38  default: binary
    39  
    40  all: build
    41  	$(DOCKER_RUN_DOCKER) hack/make.sh
    42  
    43  binary: build
    44  	$(DOCKER_RUN_DOCKER) hack/make.sh binary
    45  
    46  cross: build
    47  	$(DOCKER_RUN_DOCKER) hack/make.sh binary cross
    48  
    49  docs: docs-build
    50  	$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve
    51  
    52  docs-shell: docs-build
    53  	$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
    54  
    55  docs-release: docs-build
    56  	$(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT -e DISTRIBUTION_ID "$(DOCKER_DOCS_IMAGE)" ./release.sh
    57  
    58  docs-test: docs-build
    59  	$(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./test.sh
    60  
    61  test: build
    62  	$(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration test-integration-cli test-docker-py
    63  
    64  test-unit: build
    65  	$(DOCKER_RUN_DOCKER) hack/make.sh test-unit
    66  
    67  test-integration: build
    68  	$(DOCKER_RUN_DOCKER) hack/make.sh test-integration
    69  
    70  test-integration-cli: build
    71  	$(DOCKER_RUN_DOCKER) hack/make.sh binary test-integration-cli
    72  
    73  test-docker-py: build
    74  	$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
    75  
    76  validate: build
    77  	$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco validate-toml
    78  
    79  shell: build
    80  	$(DOCKER_RUN_DOCKER) bash
    81  
    82  build: bundles
    83  	docker build -t "$(DOCKER_IMAGE)" .
    84  
    85  docs-build:
    86  	( git remote | grep -v upstream ) || git diff --name-status upstream/release..upstream/docs docs/ > docs/changed-files
    87  	cp ./VERSION docs/VERSION
    88  	echo "$(GIT_BRANCH)" > docs/GIT_BRANCH
    89  	echo "$(AWS_S3_BUCKET)" > docs/AWS_S3_BUCKET
    90  	echo "$(GITCOMMIT)" > docs/GITCOMMIT
    91  	docker build -t "$(DOCKER_DOCS_IMAGE)" docs
    92  
    93  bundles:
    94  	mkdir bundles