forked from anchore/harbor-scanner-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (27 loc) · 747 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
COMMIT ?= $(shell git rev-parse HEAD)
SOURCES := $(shell find . -name '*.go')
BINARY := anchore-adapter
IMAGE_TAG ?= dev
REPOSITORY ?= anchore/harbor-scanner-adapter
IMAGE ?= $(REPOSITORY):$(IMAGE_TAG)
build: $(BINARY)
$(BINARY): $(SOURCES)
GOOS=linux GO111MODULE=on CGO_ENABLED=0 go build -o $(BINARY) cmd/anchore-adapter/main.go
.PHONY: container
container: build
docker build --build-arg COMMIT=$(COMMIT) -t $(IMAGE) .
.PHONY: test
test:
GOOS=linux GO111MODULE=on CGO_ENABLED=0 go test ./...
clean: clean-binary
.PHONY: clean-all
clean-all: clean-container clean-binary
.PHONY: clean-binary
clean-binary:
rm $(BINARY)
.PHONY: clean-container
clean-container:
docker rmi $(IMAGE)
.PHONY: push
push: container
docker push $(IMAGE)