代码拉取完成,页面将自动刷新
同步操作将从 apiok/gofly_framework 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
.PHONY:build build-local
# 程序相关信息
PROGRAM_NAME = gofly-linux-amd64
REMOTE_HOST = myali
REMOTE_PROGRAM_PATH = /data/go-project/gofly
# 说明 V 参数的指定方式
#make build-local V=v1.2.3
buildPkg = gofly
buildTime = `date '+%Y-%m-%d %H:%M:%S'`
buildGo = `go version`
buildUser = `git config user.name`
buildVersion = `git rev-parse HEAD`
buildGitBranch=`git rev-parse --abbrev-ref HEAD`
buildLastCommitUser=`git log -n 1 --format="%an"`
buildLastCommitTime=`git log -1 --date=format:"%Y-%m-%d %T" --format="%ad"`
buildLastCommitId=`git log --format="%H" -n 1`
buildLastCommitMsg=`git log -n 1 --format="%s"`
#buildTag = `git describe --abbrev=0 --tags` # https://gist.github.com/rponte/fdc0724dd984088606b0
appVersion=$(V)
ldtags = "-X '${buildPkg}/conf.BuildTime=${buildTime}' \
-X '${buildPkg}/conf.BuildGo=${buildGo}' \
-X '${buildPkg}/conf.BuildUser=${buildUser}' \
-X '${buildPkg}/conf.BuildVersion=${buildVersion}' \
-X '${buildPkg}/conf.BuildGitBranch=${buildGitBranch}' \
-X '${buildPkg}/conf.BuildLastCommitUser=${buildLastCommitUser}' \
-X '${buildPkg}/conf.BuildLastCommitTime=${buildLastCommitTime}' \
-X '${buildPkg}/conf.BuildLastCommitId=${buildLastCommitId}' \
-X '${buildPkg}/conf.BuildLastCommitMsg=${buildLastCommitMsg}' \
-X '${buildPkg}/conf.Version=${appVersion}' "
default: deploy-remote
build:
GOOS=linux GOARCH=amd64 go build -ldflags ${ldtags} -o bin/$(PROGRAM_NAME)
build-local:
go build -ldflags ${ldtags} -o bin/gofly
deploy-remote:build rsync-remote restart-remote
echo "build , rsync, restart finished"
rsync-remote:
rsync bin/$(PROGRAM_NAME) $(REMOTE_HOST):$(REMOTE_PROGRAM_PATH)/
rsync start_program.sh $(REMOTE_HOST):$(REMOTE_PROGRAM_PATH)/
# 远程重新启动程序
restart-remote:stop-remote start-remote
# 远程终止程序
stop-remote:
ssh $(REMOTE_HOST) "pkill -f '$(PROGRAM_NAME)'" || true
# 远程启动程序
start-remote:
ssh $(REMOTE_HOST) "cd $(REMOTE_PROGRAM_PATH) && ./start_program.sh"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。