-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
51 lines (35 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
50
51
# note: call scripts from /scripts
.PHONY: default build builder-image binary-image test stop clean-images clean push apply deploy
BUILDER ?= whitelister-builder
BINARY ?= Whitelister
DOCKER_IMAGE ?= stakater/whitelister
# Default value "dev"
DOCKER_TAG ?= dev
REPOSITORY = ${DOCKER_IMAGE}:${DOCKER_TAG}
VERSION=$(shell cat .version)
BUILD=
GOCMD = go
GOFLAGS ?= $(GOFLAGS:)
LDFLAGS =
default: build test
install:
"$(GOCMD)" mod download
build:
"$(GOCMD)" build ${GOFLAGS} ${LDFLAGS} -o "${BINARY}"
builder-image:
@docker build --network host -t "${BUILDER}" -f build/package/Dockerfile.build .
binary-image: builder-image
@docker run --network host --rm "${BUILDER}" | docker build --network host -t "${REPOSITORY}" -f Dockerfile.run -
test:
"$(GOCMD)" test -v ./...
stop:
@docker stop "${BINARY}"
clean-images: stop
@docker rmi "${BUILDER}" "${BINARY}"
clean:
"$(GOCMD)" clean -i
push: ## push the latest Docker image to DockerHub
docker push $(REPOSITORY)
apply:
kubectl apply -f deployments/manifests/
deploy: binary-image push apply