init
This commit is contained in:
parent
34859d9a5b
commit
d9417b47a5
21
Makefile
21
Makefile
@ -13,7 +13,14 @@ LD_GO_VERSION := -X '$(VERSION_PATH).GoVersion=`go version`'
|
||||
LD_VERSION := -X '$(VERSION_PATH).Version=$(BUILD_VERSION)'
|
||||
LD_FLAGS := "$(LD_APP_NAMW) $(LD_GIT_COMMIT) $(LD_BUILD_TIME) $(LD_GO_VERSION) $(LD_VERSION) -w -s"
|
||||
|
||||
.PHONY : build release clean install upx
|
||||
RELEASE_VERSION = $(version)
|
||||
REGISTRY_URL = $(url)
|
||||
|
||||
ifeq ("$(RELEASE_VERSION)","")
|
||||
RELEASE_VERSION := $(shell echo `date "+%Y%m%d_%H%M%S"`)
|
||||
endif
|
||||
|
||||
.PHONY : build release clean install upx docker-push docker
|
||||
|
||||
build:
|
||||
ifneq ($(shell type gox >/dev/null 2>&1;echo $$?), 0)
|
||||
@ -24,6 +31,18 @@ endif
|
||||
gox -ldflags $(LD_FLAGS) -osarch="darwin/amd64 linux/386 linux/amd64 windows/amd64" \
|
||||
-output="$(DIST_DIR){{.Dir}}_{{.OS}}_{{.Arch}}"
|
||||
|
||||
docker: build upx
|
||||
ifneq ("$(REGISTRY_URL)","")
|
||||
@echo ========== current docker tag is: $(RELEASE_VERSION) ==========
|
||||
|
||||
docker build -t $(REGISTRY_URL)/ddgo_server:$(RELEASE_VERSION) -f Dockerfile .
|
||||
else
|
||||
@echo "url arg should not be empty"
|
||||
endif
|
||||
|
||||
docker-push: docker
|
||||
docker push $(REGISTRY_URL)/ddgo_server:$(RELEASE_VERSION)
|
||||
|
||||
clean:
|
||||
rm -rf $(DIST_DIR)*
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user