Especially but not limited to:
- make BINDDIR= ... - for when you don't want a bind mount at all
- make DOCSPORT=9000 docs - for when you want a not-8000 docs port
- when we can't determine a branch name, we don't try to "docker build -t docker: ." anymore - we just "docker build -t docker ." (thus allowing Docker to assume ":latest")
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
| ... | ... |
@@ -1,14 +1,17 @@ |
| 1 | 1 |
.PHONY: all binary build cross default docs docs-build docs-shell shell test test-integration test-integration-cli |
| 2 | 2 |
|
| 3 |
-GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) |
|
| 4 |
-DOCKER_IMAGE := docker:$(GIT_BRANCH) |
|
| 5 |
-DOCKER_DOCS_IMAGE := docker-docs:$(GIT_BRANCH) |
|
| 6 |
- |
|
| 7 |
-# to allow `make BINDDIR=. shell` |
|
| 3 |
+# to allow `make BINDDIR=. shell` or `make BINDDIR= test` |
|
| 8 | 4 |
BINDDIR := bundles |
| 5 |
+# to allow `make DOCSPORT=9000 docs` |
|
| 6 |
+DOCSPORT := 8000 |
|
| 9 | 7 |
|
| 10 |
-DOCKER_RUN_DOCKER := docker run --rm -i -t --privileged -e TESTFLAGS -v "$(CURDIR)/$(BINDDIR):/go/src/github.com/dotcloud/docker/$(BINDDIR)" "$(DOCKER_IMAGE)" |
|
| 8 |
+GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) |
|
| 9 |
+DOCKER_IMAGE := docker$(if $(GIT_BRANCH),:$(GIT_BRANCH)) |
|
| 10 |
+DOCKER_DOCS_IMAGE := docker-docs$(if $(GIT_BRANCH),:$(GIT_BRANCH)) |
|
| 11 |
+DOCKER_MOUNT := $(if $(BINDDIR),-v "$(CURDIR)/$(BINDDIR):/go/src/github.com/dotcloud/docker/$(BINDDIR)") |
|
| 11 | 12 |
|
| 13 |
+DOCKER_RUN_DOCKER := docker run --rm -it --privileged -e TESTFLAGS $(DOCKER_MOUNT) "$(DOCKER_IMAGE)" |
|
| 14 |
+DOCKER_RUN_DOCS := docker run --rm -it -p $(if $(DOCSPORT),$(DOCSPORT):)8000 "$(DOCKER_DOCS_IMAGE)" |
|
| 12 | 15 |
|
| 13 | 16 |
default: binary |
| 14 | 17 |
|
| ... | ... |
@@ -22,10 +25,10 @@ cross: build |
| 22 | 22 |
$(DOCKER_RUN_DOCKER) hack/make.sh binary cross |
| 23 | 23 |
|
| 24 | 24 |
docs: docs-build |
| 25 |
- docker run --rm -i -t -p 8000:8000 "$(DOCKER_DOCS_IMAGE)" |
|
| 25 |
+ $(DOCKER_RUN_DOCS) |
|
| 26 | 26 |
|
| 27 | 27 |
docs-shell: docs-build |
| 28 |
- docker run --rm -i -t -p 8000:8000 "$(DOCKER_DOCS_IMAGE)" bash |
|
| 28 |
+ $(DOCKER_RUN_DOCS) bash |
|
| 29 | 29 |
|
| 30 | 30 |
test: build |
| 31 | 31 |
$(DOCKER_RUN_DOCKER) hack/make.sh binary test test-integration test-integration-cli |