代码拉取完成,页面将自动刷新
ROOT_DIR = $(shell pwd)
NAMESPACE = "default"
DEPLOY_NAME = "template-single"
DOCKER_NAME = "template-single"
ENV = local
CONFIG_DIR = config
#BINARY_NAME = $(shell basename `pwd`)
BINARY_NAME = main
BINARY_DIR = bin
BINARY_CONFIG = $(BINARY_DIR)/$(CONFIG_DIR)
VERSION = v1.6
NOW = $(shell date +"%Y%m%d%H%M%S")
HTTP_PORT=0
DOCKER_TAG_NAME=$(shell basename `pwd`):$(ENV)
#ldargs
LDflgs="-X 'gitee.com/igolang/pkg/boot.buildTime=$(NOW)' -X 'gitee.com/igolang/pkg/boot.version=$(VERSION)'"
.PHONY: buildBase
buildBase:
rm -rf $(ROOT_DIR)/$(BINARY_DIR)
mkdir -p $(ROOT_DIR)/$(BINARY_CONFIG)
cp -rf $(ROOT_DIR)/$(CONFIG_DIR)/$(ENV)/* $(ROOT_DIR)/$(BINARY_CONFIG)
go mod tidy -v
.PHONY: build
build: buildBase
go build -tags=jsoniter -ldflags $(LDflgs) -o $(ROOT_DIR)/$(BINARY_DIR)/$(BINARY_NAME) -v $(ROOT_DIR)/main.go
.PHONY: build.windows
build.windows: buildBase
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -tags=jsoniter -ldflags $(LDflgs) -o $(ROOT_DIR)/$(BINARY_DIR)/$(BINARY_NAME).exe -v $(ROOT_DIR)/main.go
.PHONY: build.linux
build.linux: buildBase
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags=jsoniter -ldflags $(LDflgs) -o $(ROOT_DIR)/$(BINARY_DIR)/$(BINARY_NAME) -v $(ROOT_DIR)/main.go
.PHONY: build.docker
build.docker: build.linux
cp $(ROOT_DIR)/docker-entrypoint.sh $(ROOT_DIR)/$(BINARY_DIR)/docker-entrypoint.sh
docker build . -t $(DOCKER_TAG_NAME)
.PHONY: run
run:
go run -tags=jsoniter -ldflags $(LDflgs) main.go http -p $(HTTP_PORT) --xcfg.path=$(ROOT_DIR)/config/$(ENV)
.PHONY: gen
gen:
go run -tags=jsoniter main.go gen -h
.PHONY: gen.dao
gen.dao:
go run -tags=jsoniter main.go gen -d --xcfg.path=$(ROOT_DIR)/config/$(ENV)
.PHONY: demo
demo:
go run -tags=jsoniter main.go demo --xcfg.path=$(ROOT_DIR)/config/$(ENV)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。