-
Notifications
You must be signed in to change notification settings - Fork 359
/
Makefile
49 lines (41 loc) · 1.04 KB
/
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
42
43
44
45
46
47
48
49
default: docker_build
DOCKER_IMAGE ?= quay.io/lachie83/croc-hunter
BUILD_NUMBER ?= `git rev-parse --short HEAD`
VCS_REF ?= `git rev-parse --short HEAD`
.PHONY: docker_build
docker_build:
@docker build \
--build-arg VCS_REF=$(VCS_REF) \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-t $(DOCKER_IMAGE):$(BUILD_NUMBER) .
.PHONY: docker_push
docker_push:
# Push to DockerHub
docker tag $(DOCKER_IMAGE):$(BUILD_NUMBER) $(DOCKER_IMAGE):latest
docker push $(DOCKER_IMAGE):$(BUILD_NUMBER)
docker push $(DOCKER_IMAGE):latest
# go option
GO ?= go
PKG := $(shell glide novendor)
TAGS :=
TESTS := .
TESTFLAGS :=
LDFLAGS :=
GOFLAGS :=
BINDIR := $(CURDIR)/bin
.PHONY: all
all: build
.PHONY: build
build:
GOBIN=$(BINDIR) $(GO) build $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
HAS_GLIDE := $(shell command -v glide;)
HAS_GIT := $(shell command -v git;)
.PHONY: bootstrap
bootstrap:
ifndef HAS_GLIDE
go get -u github.com/Masterminds/glide
endif
ifndef HAS_GIT
$(error You must install Git)
endif
glide install