-
Notifications
You must be signed in to change notification settings - Fork 154
/
Copy pathMakefile
49 lines (36 loc) · 1.03 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
VERSION := "0.1"
GIT_COMMIT := $(shell git rev-parse --short HEAD)
GO := go
CGO_ENABLED ?= 0
# Force modules on and to use the vendor directory.
GO := CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on GOFLAGS=-mod=vendor go
######################################################
#
# Development targets
#
######################################################
LDFLAGS := -X github.com/open-policy-agent/contrib/data_filter_mongodb/internal/version.Vcs=$(GIT_COMMIT) \
-X github.com/open-policy-agent/contrib/data_filter_mongodb/internal/version.Version=$(VERSION)
.PHONY: build-binary
build-binary:
go build -o bin/opa-mongo github.com/open-policy-agent/contrib/data_filter_mongodb
.PHONY: vet
vet:
go vet ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: lint
lint:
golangci-lint run
.PHONY: test
test:
$(GO) test ./...
.PHONY: build
build:
docker build -t $(REPOSITORY):latest -t $(REPOSITORY):$(VERSION) .
.PHONY: push
push: build
docker push $(REPOSITORY):$(VERSION)
docker push $(REPOSITORY):latest
all: build-binary vet fmt lint test build push