Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2017-05-17 12:08:50 -04:00
Родитель b28c4822cc
Коммит 73ebb07df5
2 изменённых файлов: 24 добавлений и 27 удалений

Просмотреть файл

@ -1,49 +1,47 @@
#
# github.com/docker/cli
#
all: binary
# remove build artifacts
.PHONY: clean
clean:
@rm -rf ./build/* cli/winresources/rsrc_*
rm -rf ./build/* cli/winresources/rsrc_*
# run go test
# the "-tags daemon" part is temporary
.PHONY: test
test:
@go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
go test -tags daemon -v $(shell go list ./... | grep -v /vendor/)
.PHONY: lint
lint:
@gometalinter --config gometalinter.json ./...
gometalinter --config gometalinter.json ./...
.PHONY: binary
binary:
@./scripts/build/binary
@echo "WARNING: binary creates a Linux executable. Use cross for macOS or Windows."
./scripts/build/binary
# build the CLI for multiple architectures
.PHONY: cross
cross:
@./scripts/build/cross
./scripts/build/cross
.PHONY: dynbinary
dynbinary:
@./scripts/build/dynbinary
./scripts/build/dynbinary
.PHONY: watch
watch:
@./scripts/test/watch
./scripts/test/watch
# download dependencies (vendor/) listed in vendor.conf
.PHONY: vendor
# Check vendor matches vendor.conf
vendor: vendor.conf
@vndr 2> /dev/null
@scripts/validate/check-git-diff vendor
vndr 2> /dev/null
scripts/validate/check-git-diff vendor
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
go generate github.com/docker/cli/cli/compose/schema
compose-jsonschema: cli/compose/schema/bindata.go
@scripts/validate/check-git-diff cli/compose/schema/bindata.go
scripts/validate/check-git-diff cli/compose/schema/bindata.go

Просмотреть файл

@ -12,60 +12,59 @@ 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 .
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 .
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 .
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
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
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
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
docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
.PHONY: watch
watch: build_docker_image
@docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch
docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make watch
# 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
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)
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
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
docker run -ti --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary