2017-04-25 19:57:06 +03:00
|
|
|
#
|
|
|
|
# github.com/docker/cli
|
|
|
|
#
|
|
|
|
# Makefile for developing using Docker
|
|
|
|
#
|
|
|
|
|
2017-08-15 23:59:43 +03:00
|
|
|
DEV_DOCKER_IMAGE_NAME = docker-cli-dev$(IMAGE_TAG)
|
2018-01-18 20:53:22 +03:00
|
|
|
BINARY_NATIVE_IMAGE_NAME = docker-cli-native$(IMAGE_TAG)
|
2017-08-15 23:59:43 +03:00
|
|
|
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)
|
2018-05-17 14:11:59 +03:00
|
|
|
E2E_IMAGE_NAME = docker-cli-e2e$(IMAGE_TAG)
|
2017-06-22 03:47:40 +03:00
|
|
|
MOUNTS = -v "$(CURDIR)":/go/src/github.com/docker/cli
|
2017-05-22 23:22:42 +03:00
|
|
|
VERSION = $(shell cat VERSION)
|
2017-12-01 16:47:20 +03:00
|
|
|
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT -e PLATFORM
|
2017-04-25 19:57:06 +03:00
|
|
|
|
|
|
|
# build docker image (dockerfiles/Dockerfile.build)
|
2017-05-10 00:29:14 +03:00
|
|
|
.PHONY: build_docker_image
|
2017-04-25 19:57:06 +03:00
|
|
|
build_docker_image:
|
2017-07-14 12:20:18 +03:00
|
|
|
docker build ${DOCKER_BUILD_ARGS} -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev .
|
2017-04-25 19:57:06 +03:00
|
|
|
|
2017-05-10 00:29:14 +03:00
|
|
|
# build docker image having the linting tools (dockerfiles/Dockerfile.lint)
|
|
|
|
.PHONY: build_linter_image
|
2017-05-02 22:10:03 +03:00
|
|
|
build_linter_image:
|
2017-07-14 12:20:18 +03:00
|
|
|
docker build ${DOCKER_BUILD_ARGS} -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
|
2017-05-02 22:10:03 +03:00
|
|
|
|
2017-05-12 01:52:17 +03:00
|
|
|
.PHONY: build_cross_image
|
|
|
|
build_cross_image:
|
2017-07-14 12:20:18 +03:00
|
|
|
docker build ${DOCKER_BUILD_ARGS} -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross .
|
2017-05-12 01:52:17 +03:00
|
|
|
|
2017-06-30 00:32:01 +03:00
|
|
|
.PHONY: build_shell_validate_image
|
|
|
|
build_shell_validate_image:
|
|
|
|
docker build -t $(VALIDATE_IMAGE_NAME) -f ./dockerfiles/Dockerfile.shellcheck .
|
2017-05-12 01:52:17 +03:00
|
|
|
|
2018-01-18 20:53:22 +03:00
|
|
|
.PHONY: build_binary_native_image
|
|
|
|
build_binary_native_image:
|
|
|
|
docker build -t $(BINARY_NATIVE_IMAGE_NAME) -f ./dockerfiles/Dockerfile.binary-native .
|
|
|
|
|
2018-05-17 14:11:59 +03:00
|
|
|
.PHONY: build_e2e_image
|
|
|
|
build_e2e_image:
|
|
|
|
docker build -t $(E2E_IMAGE_NAME) --build-arg VERSION=$(VERSION) --build-arg GITCOMMIT=$(GITCOMMIT) -f ./dockerfiles/Dockerfile.e2e .
|
|
|
|
|
2018-01-18 20:53:22 +03:00
|
|
|
|
2017-04-25 19:57:06 +03:00
|
|
|
# build executable using a container
|
2018-01-18 20:53:22 +03:00
|
|
|
binary: build_binary_native_image
|
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(BINARY_NATIVE_IMAGE_NAME)
|
2017-05-12 19:07:57 +03:00
|
|
|
|
|
|
|
build: binary
|
2017-04-25 19:57:06 +03:00
|
|
|
|
2018-01-18 20:53:22 +03:00
|
|
|
|
2017-04-25 19:57:06 +03:00
|
|
|
# clean build artifacts using a container
|
2017-05-10 00:29:14 +03:00
|
|
|
.PHONY: clean
|
2017-04-25 19:57:06 +03:00
|
|
|
clean: build_docker_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
|
2017-04-25 19:57:06 +03:00
|
|
|
|
2017-04-28 01:57:35 +03:00
|
|
|
# run go test
|
2017-08-14 22:47:06 +03:00
|
|
|
.PHONY: test-unit
|
|
|
|
test-unit: build_docker_image
|
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test-unit
|
2017-04-28 01:57:35 +03:00
|
|
|
|
2017-08-31 01:06:22 +03:00
|
|
|
.PHONY: test
|
|
|
|
test: test-unit test-e2e
|
|
|
|
|
2017-04-25 19:57:06 +03:00
|
|
|
# build the CLI for multiple architectures using a container
|
2017-05-10 00:29:14 +03:00
|
|
|
.PHONY: cross
|
2017-05-14 20:24:10 +03:00
|
|
|
cross: build_cross_image
|
2017-05-24 20:26:53 +03:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
|
2017-04-25 19:57:06 +03:00
|
|
|
|
2017-09-14 01:51:30 +03:00
|
|
|
.PHONY: binary-windows
|
|
|
|
binary-windows: build_cross_image
|
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make $@
|
|
|
|
|
|
|
|
.PHONY: binary-osx
|
|
|
|
binary-osx: build_cross_image
|
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make $@
|
|
|
|
|
2017-05-16 00:00:35 +03:00
|
|
|
.PHONY: watch
|
|
|
|
watch: build_docker_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch
|
2017-05-16 00:00:35 +03:00
|
|
|
|
2017-04-25 19:57:06 +03:00
|
|
|
# start container in interactive mode for in-container development
|
2017-05-10 00:29:14 +03:00
|
|
|
.PHONY: dev
|
2017-04-25 19:57:06 +03:00
|
|
|
dev: build_docker_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run -ti $(ENVVARS) $(MOUNTS) \
|
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
|
$(DEV_DOCKER_IMAGE_NAME) ash
|
2017-05-02 22:10:03 +03:00
|
|
|
|
2017-05-12 01:52:17 +03:00
|
|
|
shell: dev
|
|
|
|
|
2017-05-03 21:14:06 +03:00
|
|
|
# run linters in a container
|
2017-05-10 00:29:14 +03:00
|
|
|
.PHONY: lint
|
2017-05-02 22:10:03 +03:00
|
|
|
lint: build_linter_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run -ti $(ENVVARS) $(MOUNTS) $(LINTER_IMAGE_NAME)
|
2017-05-10 00:29:14 +03:00
|
|
|
|
|
|
|
# download dependencies (vendor/) listed in vendor.conf, using a container
|
|
|
|
.PHONY: vendor
|
|
|
|
vendor: build_docker_image vendor.conf
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
|
2017-05-12 01:52:17 +03:00
|
|
|
|
|
|
|
dynbinary: build_cross_image
|
2017-05-11 04:24:32 +03:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary
|
|
|
|
|
2018-01-02 17:47:31 +03:00
|
|
|
.PHONY: authors
|
|
|
|
authors: ## generate AUTHORS file from git history
|
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make authors
|
|
|
|
|
2017-05-11 04:24:32 +03:00
|
|
|
## generate man pages from go source and markdown
|
|
|
|
.PHONY: manpages
|
|
|
|
manpages: build_docker_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make manpages
|
2017-05-11 04:24:32 +03:00
|
|
|
|
|
|
|
## Generate documentation YAML files consumed by docs repo
|
|
|
|
.PHONY: yamldocs
|
|
|
|
yamldocs: build_docker_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make yamldocs
|
2017-06-29 16:10:04 +03:00
|
|
|
|
|
|
|
.PHONY: shellcheck
|
2017-06-30 00:32:01 +03:00
|
|
|
shellcheck: build_shell_validate_image
|
2017-06-23 07:52:34 +03:00
|
|
|
docker run -ti --rm $(ENVVARS) $(MOUNTS) $(VALIDATE_IMAGE_NAME) make shellcheck
|
2017-08-14 22:47:06 +03:00
|
|
|
|
2017-08-15 23:59:43 +03:00
|
|
|
.PHONY: test-e2e
|
2018-06-25 12:46:35 +03:00
|
|
|
test-e2e: test-e2e-non-experimental test-e2e-experimental
|
|
|
|
|
|
|
|
.PHONY: test-e2e-experimental
|
|
|
|
test-e2e-experimental: build_e2e_image
|
|
|
|
docker run -e DOCKERD_EXPERIMENTAL=1 --rm -v /var/run/docker.sock:/var/run/docker.sock $(E2E_IMAGE_NAME)
|
|
|
|
|
|
|
|
.PHONY: test-e2e-non-experimental
|
|
|
|
test-e2e-non-experimental: build_e2e_image
|
2018-05-17 14:11:59 +03:00
|
|
|
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock $(E2E_IMAGE_NAME)
|