forked from rancher/image-build-calico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (43 loc) · 1.07 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
SEVERITIES = HIGH,CRITICAL
UNAME_M = $(shell uname -m)
ARCH=
ifeq ($(UNAME_M), x86_64)
ARCH=amd64
else ifeq ($(UNAME_M), aarch64)
ARCH=arm64
else
ARCH=$(UNAME_M)
endif
BUILD_META=-build$(shell date +%Y%m%d)
ORG ?= rancher
TAG ?= v3.28.0$(BUILD_META)
K3S_ROOT_VERSION ?= v0.13.0
ifeq (,$(filter %$(BUILD_META),$(TAG)))
$(error TAG $(TAG) needs to end with build metadata: $(BUILD_META))
endif
.PHONY: image-build
image-build:
docker buildx build --no-cache \
--platform=$(ARCH) \
--pull \
--build-arg TAG=$(TAG:$(BUILD_META)=) \
--build-arg K3S_ROOT_VERSION=$(K3S_ROOT_VERSION) \
--tag $(ORG)/hardened-calico:$(TAG) \
--tag $(ORG)/hardened-calico:$(TAG)-$(ARCH) \
--load \
.
.PHONY: image-push
image-push:
docker push $(ORG)/hardened-calico:$(TAG)-$(ARCH)
.PHONY: image-scan
image-scan:
trivy image --severity $(SEVERITIES) --no-progress --ignore-unfixed $(ORG)/hardened-calico:$(TAG)
PHONY: log
log:
@echo "ARCH=$(ARCH)"
@echo "TAG=$(TAG)"
@echo "ORG=$(ORG)"
@echo "PKG=$(PKG)"
@echo "SRC=$(SRC)"
@echo "BUILD_META=$(BUILD_META)"
@echo "UNAME_M=$(UNAME_M)"