代码拉取完成,页面将自动刷新
default: all
# Do a parallel build with multiple jobs, based on the number of CPUs online
# in this system: 'make -j8' on a 8-CPU system, etc.
ifeq ($(JOBS),)
JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
ifeq ($(JOBS),)
JOBS := $(shell sysctl -n hw.logicalcpu 2>/dev/null)
ifeq ($(JOBS),)
JOBS := 1
endif
endif
endif
use_all_cores:
make -j$(JOBS) all
# git information
GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
GIT_DIRTY ?= $(shell test -n "`git status --porcelain`" && echo "+CHANGES" || true)
GIT_DESCRIBE ?= $(shell git describe --tags --always)
COMMIT := $(GIT_COMMIT)$(GIT_DIRTY)
VERSION := $(GIT_DESCRIBE)
SHIP_VERSION := $(shell docker image inspect -f "{{ .Config.Labels.version }}" $(IMAGE):latest 2>/dev/null)
MODULE := github.com/dayun
BUILDER := dayun/dayun-go-builder
IMAGE := dayun/dayun-go
IMAGE_TAR := $(subst /,_,$(IMAGE)).$(SHIP_VERSION).tar
IMAGE_TAR_GZ := $(IMAGE_TAR).gz
branch := $(shell git rev-parse --abbrev-ref HEAD)
buildDate := $(shell date +%Y%m%d%H%M%S)
Uname := $(shell uname)
ifeq ($(Uname),Linux)
platform := linux
else
ifeq ($(Uname),Darwin)
platform := darwin
endif
endif
ifdef APPVERSION
version := $(APPVERSION)-$(buildDate)
else
version := $(branch)-$(GIT_COMMIT)-$(buildDate)
endif
tags := $(platform) release
GO_BUILD := CGO_ENABLED=1 go build -tags "$(tags)"
status:
@echo "Commit: $(COMMIT) Version: $(VERSION) Ship Version: $(SHIP_VERSION)"
builder: status
docker build \
--tag $(BUILDER):$(VERSION) \
--tag $(BUILDER):latest \
--build-arg BUILD_ARG=release \
-f docker/builder.Dockerfile \
.
# 生成镜像文件
docker: builder
docker build \
--tag $(IMAGE):$(VERSION) \
--tag $(IMAGE):latest \
--build-arg COMMIT=$(COMMIT) \
--build-arg VERSION=$(VERSION) \
-f docker/Dockerfile \
.
docker_clean: status
docker rmi -f $(BUILDER):latest
docker rmi -f $(IMAGE):latest
docker rmi -f $(BUILDER):$(VERSION)
docker rmi -f $(IMAGE):$(VERSION)
save: status
ifeq ($(SHIP_VERSION),)
$(error No version to ship, please build first)
endif
docker save $(IMAGE):$(SHIP_VERSION) > $(IMAGE_TAR)
tar zcf $(IMAGE_TAR_GZ) $(IMAGE_TAR)
start:
docker-compose down
docker-compose up --no-start
docker-compose start
stop:
docker-compose down
logs:
docker-compose logs -f --tail=10
push_testnet:
docker tag $(IMAGE):$(VERSION) $(IMAGE):testnet
docker push $(IMAGE):testnet
push_bench:
docker tag $(IMAGE):$(VERSION) $(IMAGE):bench
docker push $(IMAGE):bench
push_staging:
docker tag $(IMAGE):$(VERSION) $(IMAGE):staging
docker push $(IMAGE):staging
push:
docker push $(IMAGE):$(VERSION)
docker push $(IMAGE):latest
bin/utils:
$(GO_BUILD)
all: bin/utils
release:
ifeq ($(Uname),Linux)
make alpine_release;
else
make -j$(JOBS) build_release;
tar czvf dayun-bin.tgz bin/*;
endif
build_release: all
alpine_release: build_release
temp_container = $$(docker create $(BUILDER):$(VERSION)) ; \
docker cp $${temp_container}:/go/src/github.com/dayun/bin - | gzip > dayun-bin.tgz
clean:
rm -rf bin/dy-*
rm -f *.cover.out
rm -f coverage.txt
.PHONY: vendor
vendor:
go mod tidy
go mod vendor
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。