3 Star 0 Fork 0

igo/imoney

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
layte.xiao 提交于 2024-01-10 09:22 . boot
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)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/igolang/imoney.git
git@gitee.com:igolang/imoney.git
igolang
imoney
imoney
master

搜索帮助