forked from rancher/image-build-cni-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (35 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
SEVERITIES = HIGH,CRITICAL
ifeq ($(ARCH),)
ARCH=$(shell go env GOARCH)
endif
BUILD_META=-build$(shell date +%Y%m%d)
ORG ?= rancher
TAG ?= v1.0.1$(BUILD_META)
ifneq ($(DRONE_TAG),)
TAG := $(DRONE_TAG)
endif
ifeq (,$(filter %$(BUILD_META),$(TAG)))
$(error TAG needs to end with build metadata: $(BUILD_META))
endif
.PHONY: image-build
image-build:
docker build \
--pull \
--build-arg ARCH=$(ARCH) \
--build-arg TAG=$(TAG:$(BUILD_META)=) \
--tag $(ORG)/hardened-cni-plugins:$(TAG) \
--tag $(ORG)/hardened-cni-plugins:$(TAG)-$(ARCH) \
.
.PHONY: image-push
image-push:
docker push $(ORG)/hardened-cni-plugins:$(TAG)-$(ARCH)
.PHONY: image-manifest
image-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create --amend \
$(ORG)/hardened-cni-plugins:$(TAG) \
$(ORG)/hardened-cni-plugins:$(TAG)-$(ARCH)
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push \
$(ORG)/hardened-cni-plugins:$(TAG)
.PHONY: image-scan
image-scan:
trivy --severity $(SEVERITIES) --no-progress --ignore-unfixed $(ORG)/hardened-cni-plugins:$(TAG)