forked from kovetskiy/mark
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
41 lines (31 loc) · 905 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
NAME = $(notdir $(PWD))
VERSION = $(shell git describe --tags --abbrev=0)
GO111MODULE = on
REMOTE = ollpal
version:
@echo $(VERSION)
get:
go get -v -d
build:
@echo :: building go binary $(VERSION)
CGO_ENABLED=0 go build \
-ldflags "-X main.version=$(VERSION)" \
-gcflags "-trimpath $(GOPATH)/src"
image:
@echo :: building image $(NAME):$(VERSION)
@docker build -t $(NAME):$(VERSION) --build-arg http_proxy --build-arg https_proxy -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)
@docker tag $(NAME):$(VERSION) $(REMOTE)/$(NAME):latest
@docker push $(REMOTE)/$(NAME):latest
release: image push
git tag -f $(VERSION)
git push --tags
clean:
rm -rf $(NAME)