2017-04-25 12:57:06 -04:00
|
|
|
#
|
|
|
|
# github.com/docker/cli
|
|
|
|
#
|
|
|
|
# Makefile for developing using Docker
|
|
|
|
#
|
|
|
|
|
2017-08-15 16:59:43 -04:00
|
|
|
DEV_DOCKER_IMAGE_NAME = docker-cli-dev$(IMAGE_TAG)
|
|
|
|
LINTER_IMAGE_NAME = docker-cli-lint$(IMAGE_TAG)
|
|
|
|
CROSS_IMAGE_NAME = docker-cli-cross$(IMAGE_TAG)
|
|
|
|
VALIDATE_IMAGE_NAME = docker-cli-shell-validate$(IMAGE_TAG)
|
2017-06-21 20:47:40 -04:00
|
|
|
MOUNTS = -v "$(CURDIR)":/go/src/github.com/docker/cli
|
2017-05-22 16:22:42 -04:00
|
|
|
VERSION = $(shell cat VERSION)
|
2017-08-15 14:32:44 -04:00
|
|
|
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT
|
2017-04-25 12:57:06 -04:00
|
|
|
|
|
|
|
# build docker image (dockerfiles/Dockerfile.build)
|
2017-05-09 17:29:14 -04:00
|
|
|
.PHONY: build_docker_image
|
2017-04-25 12:57:06 -04:00
|
|
|
build_docker_image:
|
2017-07-14 05:20:18 -04:00
|
|
|
docker build ${DOCKER_BUILD_ARGS} -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev .
|
2017-04-25 12:57:06 -04:00
|
|
|
|
2017-05-09 17:29:14 -04:00
|
|
|
# build docker image having the linting tools (dockerfiles/Dockerfile.lint)
|
|
|
|
.PHONY: build_linter_image
|
2017-05-02 15:10:03 -04:00
|
|
|
build_linter_image:
|
2017-07-14 05:20:18 -04:00
|
|
|
docker build ${DOCKER_BUILD_ARGS} -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
|
2017-05-02 15:10:03 -04:00
|
|
|
|
2017-05-11 18:52:17 -04:00
|
|
|
.PHONY: build_cross_image
|
|
|
|
build_cross_image:
|
2017-07-14 05:20:18 -04:00
|
|
|
docker build ${DOCKER_BUILD_ARGS} -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross .
|
2017-05-11 18:52:17 -04:00
|
|
|
|
2017-06-29 17:32:01 -04:00
|
|
|
.PHONY: build_shell_validate_image
|
|
|
|
build_shell_validate_image:
|
|
|
|
docker build -t $(VALIDATE_IMAGE_NAME) -f ./dockerfiles/Dockerfile.shellcheck .
|
2017-05-11 18:52:17 -04:00
|
|
|
|
2017-04-25 12:57:06 -04:00
|
|
|
# build executable using a container
|
2017-05-12 12:07:57 -04:00
|
|
|
binary: build_docker_image
|
2017-05-24 13:26:53 -04:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
|
2017-05-12 12:07:57 -04:00
|
|
|
|
|
|
|
build: binary
|
2017-04-25 12:57:06 -04:00
|
|
|
|
|
|
|
# clean build artifacts using a container
|
2017-05-09 17:29:14 -04:00
|
|
|
.PHONY: clean
|
2017-04-25 12:57:06 -04:00
|
|
|
clean: build_docker_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
|
2017-04-25 12:57:06 -04:00
|
|
|
|
2017-04-27 18:57:35 -04:00
|
|
|
# run go test
|
2017-08-14 15:47:06 -04:00
|
|
|
.PHONY: test-unit
|
|
|
|
test-unit: build_docker_image
|
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test-unit
|
2017-04-27 18:57:35 -04:00
|
|
|
|
2017-04-25 12:57:06 -04:00
|
|
|
# build the CLI for multiple architectures using a container
|
2017-05-09 17:29:14 -04:00
|
|
|
.PHONY: cross
|
2017-05-14 13:24:10 -04:00
|
|
|
cross: build_cross_image
|
2017-05-24 13:26:53 -04:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
|
2017-04-25 12:57:06 -04:00
|
|
|
|
2017-05-15 17:00:35 -04:00
|
|
|
.PHONY: watch
|
|
|
|
watch: build_docker_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch
|
2017-05-15 17:00:35 -04:00
|
|
|
|
2017-04-25 12:57:06 -04:00
|
|
|
# start container in interactive mode for in-container development
|
2017-05-09 17:29:14 -04:00
|
|
|
.PHONY: dev
|
2017-04-25 12:57:06 -04:00
|
|
|
dev: build_docker_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run -ti $(ENVVARS) $(MOUNTS) \
|
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
|
$(DEV_DOCKER_IMAGE_NAME) ash
|
2017-05-02 15:10:03 -04:00
|
|
|
|
2017-05-11 18:52:17 -04:00
|
|
|
shell: dev
|
|
|
|
|
2017-05-03 14:14:06 -04:00
|
|
|
# run linters in a container
|
2017-05-09 17:29:14 -04:00
|
|
|
.PHONY: lint
|
2017-05-02 15:10:03 -04:00
|
|
|
lint: build_linter_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME)
|
2017-05-09 17:29:14 -04:00
|
|
|
|
|
|
|
# download dependencies (vendor/) listed in vendor.conf, using a container
|
|
|
|
.PHONY: vendor
|
|
|
|
vendor: build_docker_image vendor.conf
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
|
2017-05-11 18:52:17 -04:00
|
|
|
|
|
|
|
dynbinary: build_cross_image
|
2017-05-10 21:24:32 -04:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary
|
|
|
|
|
|
|
|
## generate man pages from go source and markdown
|
|
|
|
.PHONY: manpages
|
|
|
|
manpages: build_docker_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make manpages
|
2017-05-10 21:24:32 -04:00
|
|
|
|
|
|
|
## Generate documentation YAML files consumed by docs repo
|
|
|
|
.PHONY: yamldocs
|
|
|
|
yamldocs: build_docker_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make yamldocs
|
2017-06-29 09:10:04 -04:00
|
|
|
|
|
|
|
.PHONY: shellcheck
|
2017-06-29 17:32:01 -04:00
|
|
|
shellcheck: build_shell_validate_image
|
2017-06-23 00:52:34 -04:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(VALIDATE_IMAGE_NAME) make shellcheck
|
2017-08-14 15:47:06 -04:00
|
|
|
|
2017-08-15 16:59:43 -04:00
|
|
|
.PHONY: test-e2e
|
2017-08-14 15:47:06 -04:00
|
|
|
test-e2e: binary
|
|
|
|
./scripts/test/e2e/wrapper
|