-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (59 loc) · 1.7 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SEVERITIES = HIGH,CRITICAL
ifeq ($(ARCH),)
ARCH=$(shell go env GOARCH)
endif
ORG ?= rancher
TAG ?= v0
REPO=opni-opensearch-fetcher
REPO-PAYLOAD=opni-payload-receiver-service
ifneq ($(DRONE_TAG),)
TAG := $(DRONE_TAG)
endif
.PHONY: image-build
image-build:
git submodule update --init
docker build \
--pull \
--build-arg PKG=$(PKG) \
--build-arg SRC=$(SRC) \
--build-arg TAG=$(TAG:$(BUILD_META)=) \
--tag $(ORG)/$(REPO):$(TAG) \
--tag $(ORG)/$(REPO):$(TAG)-$(ARCH) \
.
.PHONY: image-build-payload
image-build-payload:
docker build \
--file Dockerfile.payload \
--pull \
--build-arg PKG=$(PKG) \
--build-arg SRC=$(SRC) \
--build-arg TAG=$(TAG:$(BUILD_META)=) \
--tag $(ORG)/$(REPO-PAYLOAD):$(TAG) \
--tag $(ORG)/$(REPO-PAYLOAD):$(TAG)-$(ARCH) \
.
.PHONY: image-push
image-push:
docker push $(ORG)/$(REPO):$(TAG)-$(ARCH)
.PHONY: image-push-payload
image-push-payload:
docker push $(ORG)/$(REPO-PAYLOAD):$(TAG)-$(ARCH)
.PHONY: image-manifest
image-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create --amend \
$(ORG)/$(REPO):$(TAG) \
$(ORG)/$(REPO):$(TAG)-$(ARCH)
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push \
$(ORG)/$(REPO):$(TAG)
.PHONY: image-manifest-payload
image-manifest-payload:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create --amend \
$(ORG)/$(REPO-PAYLOAD):$(TAG) \
$(ORG)/$(REPO-PAYLOAD):$(TAG)-$(ARCH)
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push \
$(ORG)/$(REPO-PAYLOAD):$(TAG)
.PHONY: image-scan
image-scan:
trivy --severity $(SEVERITIES) --no-progress --ignore-unfixed $(ORG)/$(REPO):$(TAG)
.PHONY: image-scan-payload
image-scan-payload:
trivy --severity $(SEVERITIES) --no-progress --ignore-unfixed $(ORG)/$(REPO-PAYLOAD):$(TAG)