add grpc version to image, add command to build gw with multiple grpc versions

This commit is contained in:
Evgeniy Kulikov 2020-02-25 18:38:47 +03:00
parent 62c6bbd875
commit 4715468f3a
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2

View file

@ -1,5 +1,7 @@
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)
HUB_IMAGE=nspccdev/neofs
B=\033[0;1m
@ -8,7 +10,7 @@ R=\033[0m
# Show current version
version:
@echo $(VERSION)
@echo $(VERSION)-$(GRPC_VERSION)
# Make sure that all files added to commit
deps:
@ -19,9 +21,30 @@ deps:
@printf "${B}${G}⇒ Store vendor localy${R}: "
@go mod vendor && echo OK || (echo fail && exit 2)
image: GRPC_VERSION?=
image: deps
@echo "${B}${G}⇒ Build GW docker-image ${R}"
@echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}"
@docker build \
--build-arg VERSION=$(VERSION) \
--build-arg VERSION=$(VERSION)-$(GRPC_VERSION) \
-f Dockerfile \
-t $(HUB_IMAGE)-http-gate:$(VERSION) .
-t $(HUB_IMAGE)-http-gate:$(VERSION)-$(GRPC_VERSION) .
.PHONY: dev
# v1.24.0 v1.25.1 v1.26.0 v1.27.1
dev: VERSIONS?=$(GRPC_VERSION)
dev:
@echo "=> Build multiple images for $(VERSIONS)"; \
for v in $(VERSIONS); do \
curdir=$$(pwd); \
echo "=> Checkout gRPC to $${v}"; \
cd ../grpc-go; \
git checkout $${v} &> /dev/null || (echo "Release $${v} not found" && exit 2); \
cd ../neofs-api; \
git checkout go.{sum,mod}; \
go get google.golang.org/grpc@$${v}; \
cd $${curdir}; \
git checkout go.{sum,mod}; \
go get google.golang.org/grpc@$${v}; \
make image GRPC_VERSION=$${v}; \
done