mark/Makefile

45 lines
915 B
Makefile
Raw Normal View History

2019-03-26 14:42:26 +03:00
NAME = $(notdir $(PWD))
2020-07-25 11:09:06 +03:00
VERSION = $(shell git describe --tags --abbrev=0)
2019-03-26 14:42:26 +03:00
GO111MODULE = on
2019-03-26 14:42:26 +03:00
REMOTE = kovetskiy
version:
@echo $(VERSION)
get:
go get -v -d
build:
@echo :: building go binary $(VERSION)
CGO_ENABLED=0 go build \
2019-03-26 14:42:26 +03:00
-ldflags "-X main.version=$(VERSION)" \
-gcflags "-trimpath $(GOPATH)/src"
2023-01-05 11:25:14 +01:00
test:
go test -race -coverprofile=profile.cov ./...
2019-03-26 14:42:26 +03:00
image:
@echo :: building image $(NAME):$(VERSION)
@docker build -t $(NAME):$(VERSION) -f Dockerfile .
docker tag $(NAME):$(VERSION) $(NAME):latest
push:
$(if $(REMOTE),,$(error REMOTE is not set))
$(eval VERSION ?= latest)
$(eval TAG ?= $(REMOTE)/$(NAME):$(VERSION))
@echo :: pushing image $(TAG)
@docker tag $(NAME):$(VERSION) $(TAG)
@docker push $(TAG)
2019-03-26 14:55:38 +03:00
@docker tag $(NAME):$(VERSION) $(REMOTE)/$(NAME):latest
2019-03-26 14:42:26 +03:00
@docker push $(REMOTE)/$(NAME):latest
2020-04-16 14:18:05 +03:00
release: image push
git tag -f $(VERSION)
git push --tags
2019-03-26 14:42:26 +03:00
clean:
rm -rf $(NAME)