github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/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_ENGINE_OSARCH = $(shell docker version | grep 'OS/Arch' | tail -1 | cut -d':' -f2 | tr -d '[[:space:]]')
     5  DOCKER_ENGINE_GOOS = $(word 1, $(subst /, ,$(DOCKER_ENGINE_OSARCH)))
     6  DOCKER_ENGINE_GOARCH = $(word 2, $(subst /, ,$(DOCKER_ENGINE_OSARCH)))
     7  export DOCKER_ENGINE_OSARCH
     8  export DOCKER_ENGINE_GOOS
     9  export DOCKER_ENGINE_GOARCH
    10  # default for linux/amd64 and others
    11  DOCKER_FILE = Dockerfile
    12  # switch to different Dockerfile for linux/arm
    13  ifeq ($(DOCKER_ENGINE_OSARCH),linux/arm)
    14    DOCKER_FILE = Dockerfile.arm
    15  endif
    16  export DOCKER_FILE
    17  
    18  # env vars passed through directly to Docker's build scripts
    19  # to allow things like `make DOCKER_CLIENTONLY=1 binary` easily
    20  # `docs/sources/contributing/devenvironment.md ` and `project/PACKAGERS.md` have some limited documentation of some of these
    21  DOCKER_ENVS := \
    22  	-e BUILDFLAGS \
    23  	-e DOCKER_CLIENTONLY \
    24  	-e DOCKER_DEBUG \
    25  	-e DOCKER_ENGINE_GOARCH \
    26  	-e DOCKER_ENGINE_GOOS \
    27  	-e DOCKER_ENGINE_OSARCH \
    28  	-e DOCKER_EXPERIMENTAL \
    29  	-e DOCKER_FILE \
    30  	-e DOCKER_GRAPHDRIVER \
    31  	-e DOCKER_REMAP_ROOT \
    32  	-e DOCKER_STORAGE_OPTS \
    33  	-e DOCKER_USERLANDPROXY \
    34  	-e TESTDIRS \
    35  	-e TESTFLAGS \
    36  	-e TIMEOUT
    37  # 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
    38  
    39  # to allow `make BIND_DIR=. shell` or `make BIND_DIR= test`
    40  # (default to no bind mount if DOCKER_HOST is set)
    41  # note: BINDDIR is supported for backwards-compatibility here
    42  BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,bundles))
    43  DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(CURDIR)/$(BIND_DIR):/go/src/github.com/docker/docker/$(BIND_DIR)")
    44  
    45  
    46  GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
    47  DOCKER_IMAGE := docker-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    48  DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH))
    49  
    50  DOCKER_FLAGS := docker run --rm -i --privileged $(DOCKER_ENVS) $(DOCKER_MOUNT)
    51  
    52  # if this session isn't interactive, then we don't want to allocate a
    53  # TTY, which would fail, but if it is interactive, we do want to attach
    54  # so that the user can send e.g. ^C through.
    55  INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
    56  ifeq ($(INTERACTIVE), 1)
    57  	DOCKER_FLAGS += -t
    58  endif
    59  
    60  DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
    61  
    62  default: binary
    63  
    64  all: build
    65  	$(DOCKER_RUN_DOCKER) hack/make.sh
    66  
    67  binary: build
    68  	$(DOCKER_RUN_DOCKER) hack/make.sh binary
    69  
    70  build: bundles
    71  	docker build -t "$(DOCKER_IMAGE)" -f $(DOCKER_FILE) .
    72  
    73  bundles:
    74  	mkdir bundles
    75  
    76  cross: build
    77  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary binary cross
    78  
    79  deb: build
    80  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-deb
    81  
    82  docs:
    83  	$(MAKE) -C docs docs
    84  
    85  rpm: build
    86  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-rpm
    87  
    88  shell: build
    89  	$(DOCKER_RUN_DOCKER) bash
    90  
    91  test: build
    92  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary cross test-unit test-integration-cli test-docker-py
    93  
    94  test-docker-py: build
    95  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-docker-py
    96  
    97  test-integration-cli: build
    98  	$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary test-integration-cli
    99  
   100  test-unit: build
   101  	$(DOCKER_RUN_DOCKER) hack/make.sh test-unit
   102  
   103  validate: build
   104  	$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet