diff --git a/Makefile b/Makefile index 97c77f6f6..65793c7aa 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ # Use of this source code is governed by a Apache license # that can be found in the LICENSE file. +# The binary to build +BIN ?= kubesphere + TRAG.Org:=kubesphere TRAG.Name:=ks-apiserver TRAG.Gopkg:=kubesphere.io/kubesphere @@ -12,6 +15,8 @@ RUN_IN_DOCKER:=docker run -it --rm -v `pwd`:/go/src/$(TRAG.Gopkg) -v `pwd`/tmp/c GO_FMT:=goimports -l -w -e -local=kubesphere -srcdir=/go/src/$(TRAG.Gopkg) GO_FILES:=./cmd ./pkg +REGISTRY ?= kubespheredev/ks-apiserver + define get_diff_files $(eval DIFF_FILES=$(shell git diff --name-only --diff-filter=ad | grep -E "^(test|cmd|pkg)/.+\.go")) endef @@ -92,7 +97,7 @@ build: fmt $(call get_build_flags) $(RUN_IN_DOCKER) time go install -ldflags '$(BUILD_FLAG)' $(TRAG.Gopkg)/cmd/... mv ./tmp/bin/cmd ./tmp/bin/$(TRAG.Name) - @docker build -t $(TRAG.Org)/$(TRAG.Name) -f - ./tmp < ./Dockerfile.dev + @docker build -t ${REGISTRY}/$(TRAG.Name) -f - ./tmp < ./Dockerfile.dev @docker image prune -f 1>/dev/null 2>&1 @echo "build done"