github.com/codemac/docker@v1.2.1-0.20150518222241-6a18412d5b9c/Makefile (about)

     1  .PHONY: all binary build cross default docs docs-build docs-shell shell test test-unit 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 DOCKER_STORAGE_OPTS \
    12  	-e TESTDIRS \
    13  	-e TESTFLAGS \
    14  	-e TIMEOUT
    15  # 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
    16  
    17  # to allow `make BIND_DIR=. shell` or `make BIND_DIR= test`
    18  # (default to no bind mount if DOCKER_HOST is set)
    19  # note: BINDDIR is supported for backwards-compatibility here
    20  BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,bundles))
    21  DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)")
    22  
    23  # to allow `make DOCSDIR=docs docs-shell` (to create a bind mount in docs)
    24  DOCS_MOUNT := $(if $(DOCSDIR),-v $(CURDIR)/$(DOCSDIR):/$(DOCSDIR))
    25  
    26  # to allow `make DOCSPORT=9000 docs`
    27  DOCSPORT := 8000
    28  
    29  GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
    30  DOCKER_IMAGE := docker-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    31  DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    32  
    33  DOCKER_RUN_DOCKER := docker run --rm -it --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) "$(DOCKER_IMAGE)"
    34  
    35  DOCKER_RUN_DOCS := docker run --rm -it $(DOCS_MOUNT) -e AWS_S3_BUCKET -e NOCACHE
    36  
    37  # for some docs workarounds (see below in "docs-build" target)
    38  GITCOMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
    39  
    40  default: binary
    41  
    42  all: build
    43  	$(DOCKER_RUN_DOCKER) hack/make.sh
    44  
    45  binary: build
    46  	$(DOCKER_RUN_DOCKER) hack/make.sh binary
    47  
    48  cross: build
    49  	$(DOCKER_RUN_DOCKER) hack/make.sh binary cross
    50  
    51  docs: docs-build
    52  	$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" mkdocs serve
    53  
    54  docs-shell: docs-build
    55  	$(DOCKER_RUN_DOCS) -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" bash
    56  
    57  docs-release: docs-build
    58  	$(DOCKER_RUN_DOCS) -e OPTIONS -e BUILD_ROOT -e DISTRIBUTION_ID \
    59  		-v $(CURDIR)/docs/awsconfig:/docs/awsconfig \
    60  		"$(DOCKER_DOCS_IMAGE)" ./release.sh
    61  
    62  docs-test: docs-build
    63  	$(DOCKER_RUN_DOCS) "$(DOCKER_DOCS_IMAGE)" ./test.sh
    64  
    65  test: build
    66  	$(DOCKER_RUN_DOCKER) hack/make.sh binary cross test-unit test-integration-cli test-docker-py
    67  
    68  test-unit: build
    69  	$(DOCKER_RUN_DOCKER) hack/make.sh test-unit
    70  
    71  test-integration-cli: build
    72  	$(DOCKER_RUN_DOCKER) hack/make.sh binary test-integration-cli
    73  
    74  test-docker-py: build
    75  	$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
    76  
    77  validate: build
    78  	$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-test validate-toml validate-vet
    79  
    80  shell: build
    81  	$(DOCKER_RUN_DOCKER) bash
    82  
    83  build: bundles
    84  	docker build -t "$(DOCKER_IMAGE)" .
    85  
    86  docs-build:
    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 pull docs/base
    92  	docker build -t "$(DOCKER_DOCS_IMAGE)" docs
    93  
    94  bundles:
    95  	mkdir bundles