Update Makefile and targets
- add `help.mk` to show information about all targets - update Makefile Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
parent
269505c989
commit
dc7aa694b8
2 changed files with 23 additions and 1 deletions
13
Makefile
13
Makefile
|
@ -1,3 +1,6 @@
|
|||
-include .env
|
||||
-include help.mk
|
||||
|
||||
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
|
||||
|
||||
GRPC_VERSION=$(shell go list -m google.golang.org/grpc | cut -d " " -f 2)
|
||||
|
@ -8,6 +11,8 @@ B=\033[0;1m
|
|||
G=\033[0;92m
|
||||
R=\033[0m
|
||||
|
||||
.PHONY: version deps image publish
|
||||
|
||||
# Show current version
|
||||
version:
|
||||
@echo "Current version: $(VERSION)-$(GRPC_VERSION)"
|
||||
|
@ -21,6 +26,7 @@ deps:
|
|||
@printf "${B}${G}⇒ Store vendor localy${R}: "
|
||||
@go mod vendor && echo OK || (echo fail && exit 2)
|
||||
|
||||
# Build docker image
|
||||
image: VERSION?=
|
||||
image: deps
|
||||
@echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}"
|
||||
|
@ -29,9 +35,14 @@ image: deps
|
|||
-f Dockerfile \
|
||||
-t $(HUB_IMAGE)-http-gate:$(VERSION) .
|
||||
|
||||
# Publish docker image
|
||||
publish:
|
||||
@echo "${B}${G}⇒ publish docker image ${R}"
|
||||
@docker push $(HUB_IMAGE)-http-gate:$(VERSION)
|
||||
|
||||
.PHONY: dev
|
||||
|
||||
# v1.24.0 v1.25.1 v1.26.0 v1.27.1
|
||||
# Build development docker images
|
||||
dev: VERSIONS?=$(GRPC_VERSION)
|
||||
dev:
|
||||
@echo "=> Build multiple images for $(VERSIONS)"; \
|
||||
|
|
11
help.mk
Normal file
11
help.mk
Normal file
|
@ -0,0 +1,11 @@
|
|||
.PHONY: help
|
||||
|
||||
# Show this help prompt
|
||||
help:
|
||||
@echo ' Usage:'
|
||||
@echo ''
|
||||
@echo ' make <target>'
|
||||
@echo ''
|
||||
@echo ' Targets:'
|
||||
@echo ''
|
||||
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort | uniq
|
Loading…
Reference in a new issue