forked from open-policy-agent/kube-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (44 loc) · 1.09 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
52
53
54
55
56
BIN := kube-mgmt
PKG := github.com/open-policy-agent/kube-mgmt
REGISTRY ?= openpolicyagent
VERSION := 0.12-dev
ARCH := amd64
COMMIT := $(shell ./build/get-build-commit.sh)
IMAGE := $(REGISTRY)/$(BIN)
BUILD_IMAGE ?= golang:1.12-alpine
.PHONY: all
all: image
.PHONY: build
build:
docker run -it \
-v $$(pwd)/.go:/go \
-v $$(pwd):/go/src/$(PKG) \
-v $$(pwd)/bin/linux_$(ARCH):/go/bin \
-v $$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static \
-w /go/src/$(PKG) \
$(BUILD_IMAGE) \
/bin/sh -c "ARCH=$(ARCH) VERSION=$(VERSION) COMMIT=$(COMMIT) PKG=$(PKG) ./build/build.sh"
.PHONY: image
image: build
docker build -t $(IMAGE):$(VERSION) -f Dockerfile .
docker tag $(IMAGE):$(VERSION) $(IMAGE):latest
.PHONY: clean
clean:
rm -fr bin .go
.PHONY: undeploy
undeploy:
kubectl delete -f manifests/deployment-opa.yml || true
.PHONY: deploy
deploy:
kubectl create -f manifests/deployment-opa.yml
.PHONY: up
up: image undeploy deploy
.PHONY: push
push:
docker push $(IMAGE):$(VERSION)
.PHONY: push-latest
push-latest:
docker push $(IMAGE):latest
.PHONY: version
version:
@echo $(VERSION)