github.com/45cali/docker@v1.11.1/Makefile (about) 1 .PHONY: all binary build cross default docs docs-build docs-shell shell test test-docker-py test-integration-cli test-unit validate 2 3 # get OS/Arch of docker engine 4 DOCKER_OSARCH := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKER_ENGINE_OSARCH:-$$DOCKER_CLIENT_OSARCH}') 5 DOCKERFILE := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKERFILE}') 6 7 # env vars passed through directly to Docker's build scripts 8 # to allow things like `make DOCKER_CLIENTONLY=1 binary` easily 9 # `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these 10 DOCKER_ENVS := \ 11 -e BUILDFLAGS \ 12 -e KEEPBUNDLE \ 13 -e DOCKER_BUILD_GOGC \ 14 -e DOCKER_BUILD_PKGS \ 15 -e DOCKER_CLIENTONLY \ 16 -e DOCKER_DEBUG \ 17 -e DOCKER_EXPERIMENTAL \ 18 -e DOCKER_GRAPHDRIVER \ 19 -e DOCKER_INCREMENTAL_BINARY \ 20 -e DOCKER_REMAP_ROOT \ 21 -e DOCKER_STORAGE_OPTS \ 22 -e DOCKER_USERLANDPROXY \ 23 -e TESTDIRS \ 24 -e TESTFLAGS \ 25 -e TIMEOUT 26 # 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 27 28 # to allow `make BIND_DIR=. shell` or `make BIND_DIR= test` 29 # (default to no bind mount if DOCKER_HOST is set) 30 # note: BINDDIR is supported for backwards-compatibility here 31 BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,bundles)) 32 DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)") 33 34 # This allows the test suite to be able to run without worrying about the underlying fs used by the container running the daemon (e.g. aufs-on-aufs), so long as the host running the container is running a supported fs. 35 # The volume will be cleaned up when the container is removed due to `--rm`. 36 # Note that `BIND_DIR` will already be set to `bundles` if `DOCKER_HOST` is not set (see above BIND_DIR line), in such case this will do nothing since `DOCKER_MOUNT` will already be set. 37 DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v "/go/src/github.com/docker/docker/bundles") 38 39 GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) 40 DOCKER_IMAGE := docker-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 41 DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH)) 42 43 DOCKER_FLAGS := docker run --rm -i --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT) 44 45 # if this session isn't interactive, then we don't want to allocate a 46 # TTY, which would fail, but if it is interactive, we do want to attach 47 # so that the user can send e.g. ^C through. 48 INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0) 49 ifeq ($(INTERACTIVE), 1) 50 DOCKER_FLAGS += -t 51 endif 52 53 DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)" 54 55 default: binary 56 57 all: build 58 $(DOCKER_RUN_DOCKER) hack/make.sh 59 60 binary: build 61 $(DOCKER_RUN_DOCKER) hack/make.sh binary 62 63 build: bundles 64 docker build ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" . 65 66 bundles: 67 mkdir bundles 68 69 cross: build 70 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross 71 72 win: build 73 $(DOCKER_RUN_DOCKER) hack/make.sh win 74 75 tgz: build 76 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross tgz 77 78 deb: build 79 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-deb 80 81 docs: 82 $(MAKE) -C docs docs 83 84 gccgo: build 85 $(DOCKER_RUN_DOCKER) hack/make.sh gccgo 86 87 rpm: build 88 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-rpm 89 90 shell: build 91 $(DOCKER_RUN_DOCKER) bash 92 93 test: build 94 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary cross test-unit test-integration-cli test-docker-py 95 96 test-docker-py: build 97 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-docker-py 98 99 test-integration-cli: build 100 $(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-integration-cli 101 102 test-unit: build 103 $(DOCKER_RUN_DOCKER) hack/make.sh test-unit 104 105 validate: build 106 $(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-default-seccomp validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet validate-vendor