2021-02-08 09:45:18 +00:00
|
|
|
-include .env
|
|
|
|
-include help.mk
|
|
|
|
|
|
|
|
HUB_IMAGE=nspccdev/neofs
|
|
|
|
|
2020-07-14 11:33:52 +00:00
|
|
|
VERSION ?= "$(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD | sed 's/^v//')"
|
2020-07-03 15:08:57 +00:00
|
|
|
BUILD_VERSION ?= "$(shell git describe --abbrev=0 --tags | sed 's/^v//')"
|
|
|
|
|
2021-02-08 09:45:18 +00:00
|
|
|
.PHONY: format deps image publish
|
2020-07-03 15:08:57 +00:00
|
|
|
|
2020-07-14 11:33:52 +00:00
|
|
|
# Show current version
|
|
|
|
version:
|
2020-12-01 07:56:02 +00:00
|
|
|
@echo $(BUILD_VERSION)
|
2020-07-14 11:33:52 +00:00
|
|
|
|
2020-07-03 15:08:57 +00:00
|
|
|
# Reformat code
|
|
|
|
format:
|
|
|
|
@[ ! -z `which goimports` ] || (echo "install goimports" && exit 2)
|
|
|
|
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
|
|
|
|
echo "⇒ Processing $$f"; \
|
|
|
|
goimports -w $$f; \
|
|
|
|
done
|
|
|
|
|
2021-02-08 09:45:18 +00:00
|
|
|
# Check and ensure dependencies
|
2020-07-03 15:08:57 +00:00
|
|
|
deps:
|
|
|
|
@printf "⇒ Ensure vendor: "
|
|
|
|
@go mod tidy -v && echo OK || (echo fail && exit 2)
|
|
|
|
@printf "⇒ Download requirements: "
|
|
|
|
@go mod download && echo OK || (echo fail && exit 2)
|
|
|
|
@printf "⇒ Store vendor localy: "
|
|
|
|
@go mod vendor && echo OK || (echo fail && exit 2)
|
|
|
|
|
|
|
|
# Build current docker image
|
2021-02-08 09:45:18 +00:00
|
|
|
image: deps
|
2020-07-03 15:08:57 +00:00
|
|
|
@echo "⇒ Build docker-image"
|
|
|
|
@docker build \
|
2020-12-01 07:56:02 +00:00
|
|
|
--build-arg VERSION=$(BUILD_VERSION) \
|
2020-07-03 15:08:57 +00:00
|
|
|
-f Dockerfile \
|
2021-02-08 09:45:18 +00:00
|
|
|
-t $(HUB_IMAGE)-s3-gate:$(BUILD_VERSION) .
|
|
|
|
|
|
|
|
# Publish docker image
|
|
|
|
publish:
|
|
|
|
@echo "${B}${G}⇒ publish docker image ${R}"
|
|
|
|
@docker push $(HUB_IMAGE)-s3-gate:$(VERSION)
|