-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (46 loc) · 1.15 KB
/
Makefile
File metadata and controls
54 lines (46 loc) · 1.15 KB
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
UNAME_M = $(shell uname -m)
ifndef TARGET_PLATFORMS
ifeq ($(UNAME_M), x86_64)
TARGET_PLATFORMS:=linux/amd64
else ifeq ($(UNAME_M), aarch64)
TARGET_PLATFORMS:=linux/arm64
else
TARGET_PLATFORMS:=linux/$(UNAME_M)
endif
endif
ifeq ($(ARCH), amd64)
ARTIFACT := k3s
else ifeq ($(ARCH), arm64)
ARTIFACT := k3s-arm64
else ifeq ($(ARCH), arm/v7)
ARTIFACT := k3s-armhf
endif
TAG ?= ${TAG}
PRIME_RIBS ?=
# sanitize the tag
DOCKER_TAG := $(shell echo $(TAG) | sed 's/+/-/g')
export DOCKER_BUILDKIT?=1
ARCH ?= amd64
REPO ?= rancher
IMAGE = $(REPO)/k3s-upgrade:$(DOCKER_TAG)
BUILD_OPTS = \
--platform=$(TARGET_PLATFORMS) \
--build-arg TAG=$(TAG) \
--build-arg ARTIFACT=$(ARTIFACT) \
--tag "$(IMAGE)"
.PHONY: push-image
push-image: download-assets
PRIME_RIBS=$(PRIME_RIBS) docker buildx build \
$(BUILD_OPTS) \
$(IID_FILE_FLAG) \
--sbom=true \
--attest type=provenance,mode=max \
--push \
--file ./Dockerfile \
.
.PHONY: publish-manifest
publish-manifest:
IMAGE=$(IMAGE) ./scripts/publish-manifest
.PHONY: download-assets
download-assets:
PRIME_RIBS=$(PRIME_RIBS) ARCH=$(ARCH) ARTIFACT=$(ARTIFACT) VERSION=$(VERSION) ./scripts/download