forked from docker/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.Makefile
67 lines (52 loc) · 1.97 KB
/
docker.Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# github.com/docker/cli
#
# Makefile for developing using Docker
#
DEV_DOCKER_IMAGE_NAME = docker-cli-dev
LINTER_IMAGE_NAME = docker-cli-lint
CROSS_IMAGE_NAME = docker-cli-cross
MOUNTS = -v `pwd`:/go/src/github.com/docker/cli
# build docker image (dockerfiles/Dockerfile.build)
.PHONY: build_docker_image
build_docker_image:
@docker build -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev .
# build docker image having the linting tools (dockerfiles/Dockerfile.lint)
.PHONY: build_linter_image
build_linter_image:
@docker build -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
.PHONY: build_cross_image
build_cross_image:
@docker build -t $(CROSS_IMAGE_NAME) -f ./dockerfiles/Dockerfile.cross .
# build executable using a container
binary: build_docker_image
@echo "WARNING: this will drop a Linux executable on your host (not a macOS or Windows one)"
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
build: binary
# clean build artifacts using a container
.PHONY: clean
clean: build_docker_image
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make clean
# run go test
.PHONY: test
test: build_docker_image
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make test
# build the CLI for multiple architectures using a container
.PHONY: cross
cross: build_cross_image
@docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
# start container in interactive mode for in-container development
.PHONY: dev
dev: build_docker_image
@docker run -ti $(MOUNTS) -v /var/run/docker.sock:/var/run/docker.sock $(DEV_DOCKER_IMAGE_NAME) ash
shell: dev
# run linters in a container
.PHONY: lint
lint: build_linter_image
@docker run -ti $(MOUNTS) $(LINTER_IMAGE_NAME)
# download dependencies (vendor/) listed in vendor.conf, using a container
.PHONY: vendor
vendor: build_docker_image vendor.conf
@docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
dynbinary: build_cross_image
@docker run -ti --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary