2021-02-05 13:51:20 +00:00
|
|
|
-include .env
|
|
|
|
-include help.mk
|
|
|
|
|
2019-11-06 12:33:46 +00:00
|
|
|
VERSION ?= "$(shell git describe --tags 2>/dev/null | sed 's/^v//')"
|
|
|
|
|
2020-02-25 15:38:47 +00:00
|
|
|
GRPC_VERSION=$(shell go list -m google.golang.org/grpc | cut -d " " -f 2)
|
|
|
|
|
2019-11-06 12:33:46 +00:00
|
|
|
HUB_IMAGE=nspccdev/neofs
|
|
|
|
|
|
|
|
B=\033[0;1m
|
|
|
|
G=\033[0;92m
|
|
|
|
R=\033[0m
|
|
|
|
|
2021-02-05 13:51:20 +00:00
|
|
|
.PHONY: version deps image publish
|
|
|
|
|
2019-11-06 12:33:46 +00:00
|
|
|
# Show current version
|
|
|
|
version:
|
2020-02-28 16:50:54 +00:00
|
|
|
@echo "Current version: $(VERSION)-$(GRPC_VERSION)"
|
2019-11-06 12:33:46 +00:00
|
|
|
|
2021-02-05 14:13:37 +00:00
|
|
|
# Check and ensure dependencies
|
2019-11-18 16:59:59 +00:00
|
|
|
deps:
|
2019-11-06 12:33:46 +00:00
|
|
|
@printf "${B}${G}⇒ Ensure vendor${R}: "
|
2019-11-18 16:59:59 +00:00
|
|
|
@go mod tidy -v && echo OK || (echo fail && exit 2)
|
2019-11-06 12:33:46 +00:00
|
|
|
@printf "${B}${G}⇒ Download requirements${R}: "
|
2019-11-18 16:59:59 +00:00
|
|
|
@go mod download && echo OK || (echo fail && exit 2)
|
2019-11-06 12:33:46 +00:00
|
|
|
@printf "${B}${G}⇒ Store vendor localy${R}: "
|
2019-11-18 16:59:59 +00:00
|
|
|
@go mod vendor && echo OK || (echo fail && exit 2)
|
2019-11-06 12:33:46 +00:00
|
|
|
|
2021-02-05 13:51:20 +00:00
|
|
|
# Build docker image
|
2020-02-28 16:50:54 +00:00
|
|
|
image: VERSION?=
|
2019-11-18 16:59:59 +00:00
|
|
|
image: deps
|
2020-02-25 15:38:47 +00:00
|
|
|
@echo "${B}${G}⇒ Build GW docker-image with $(GRPC_VERSION) ${R}"
|
2019-11-06 12:33:46 +00:00
|
|
|
@docker build \
|
2020-02-28 16:50:54 +00:00
|
|
|
--build-arg VERSION=$(VERSION) \
|
2019-11-06 12:33:46 +00:00
|
|
|
-f Dockerfile \
|
2020-02-28 16:50:54 +00:00
|
|
|
-t $(HUB_IMAGE)-http-gate:$(VERSION) .
|
2020-02-25 15:38:47 +00:00
|
|
|
|
2021-02-05 13:51:20 +00:00
|
|
|
# Publish docker image
|
|
|
|
publish:
|
|
|
|
@echo "${B}${G}⇒ publish docker image ${R}"
|
|
|
|
@docker push $(HUB_IMAGE)-http-gate:$(VERSION)
|
|
|
|
|
2020-02-25 15:38:47 +00:00
|
|
|
.PHONY: dev
|
|
|
|
|
2021-02-05 13:51:20 +00:00
|
|
|
# Build development docker images
|
2020-02-25 15:38:47 +00:00
|
|
|
dev: VERSIONS?=$(GRPC_VERSION)
|
|
|
|
dev:
|
|
|
|
@echo "=> Build multiple images for $(VERSIONS)"; \
|
2020-02-29 10:25:22 +00:00
|
|
|
git checkout go.{sum,mod}; \
|
2020-02-25 15:38:47 +00:00
|
|
|
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}; \
|
2020-02-29 10:25:22 +00:00
|
|
|
cp go_dev.mod go.mod; \
|
2020-02-25 15:38:47 +00:00
|
|
|
go get google.golang.org/grpc@$${v}; \
|
2020-02-28 16:50:54 +00:00
|
|
|
make image VERSION=$(VERSION)-$${v}; \
|
2020-02-28 16:51:49 +00:00
|
|
|
git checkout go.{sum,mod}; \
|
2020-02-25 15:38:47 +00:00
|
|
|
done
|