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