-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (67 loc) · 1.87 KB
/
Copy pathMakefile
File metadata and controls
83 lines (67 loc) · 1.87 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
GO_FILES ?= $$(find . -name '*.go')
SHELL := /bin/bash
.PHONY: docker.sock
docker.sock:
while ! docker version 1>/dev/null; do sleep 1; done
.PHONY: deps
deps:
go mod tidy
.DEFAULT_GOAL := ci
.PHONY: $(TARGETS)
build/data:
mkdir -p $@
.PHONY: binary-size-check
binary-size-check:
scripts/binary_size_check.sh
.PHONY: image-scan
image-scan:
scripts/image_scan.sh $(IMAGE)
format:
gofmt -s -l -w $(GO_FILES)
goimports -w $(GO_FILES)
.PHONY: tag-image-latest
tag-image-latest:
scripts/tag-image-latest
.PHONY: validate
validate:
docker buildx build \
--build-arg="SKIP_VALIDATE=$(SKIP_VALIDATE)" \
--build-arg="DEBUG=$(DEBUG)" \
--progress=plain \
-f Dockerfile --target=validate .
.PHONY: binary
binary:
@echo "INFO: Building K3s binaries and assets..."
. ./scripts/git_version.sh && \
docker buildx build \
--build-arg "GIT_TAG=$$GIT_TAG" \
--build-arg "TREE_STATE=$$TREE_STATE" \
--build-arg "COMMIT=$$COMMIT" \
--build-arg "DIRTY=$$DIRTY" \
--build-arg="GOCOVER=$(GOCOVER)" \
--build-arg="GOOS=$(GOOS)" \
--build-arg="DEBUG=$(DEBUG)" \
-f Dockerfile --target=result --output=. .
.PHONY: multiarch-binary
multiarch-binary:
@echo "INFO: Building K3s binaries and assets for all release platforms..."
. ./scripts/git_version.sh && \
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/riscv64,windows/amd64 \
--build-arg "GIT_TAG=$$GIT_TAG" \
--build-arg "TREE_STATE=$$TREE_STATE" \
--build-arg "COMMIT=$$COMMIT" \
--build-arg "DIRTY=$$DIRTY" \
--build-arg="GOCOVER=$(GOCOVER)" \
--build-arg="DEBUG=$(DEBUG)" \
-f Dockerfile --target=multiarch-result --output type=local,dest=.,platform-split=false .
.PHONY: image
image: binary
@echo "INFO: Building K3s image..."
./scripts/package-image
.PHONY: airgap
airgap:
@echo "INFO: Building K3s airgap tarball..."
./scripts/package-airgap
.PHONY: ci
ci: binary image airgap