-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (56 loc) · 2.05 KB
/
Makefile
File metadata and controls
67 lines (56 loc) · 2.05 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
# Shortcut targets
default: all
## Build binary for current platform
all: image
###############################################################################
# Input parameters.
###############################################################################
DOCKER_PLATFORMS ?= linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x
VERSION ?= v7.5.0
IMAGE_ORG ?= calico
IMAGE ?= $(IMAGE_ORG)/bpftool:$(VERSION)
SOURCEREF ?= $(VERSION)
SOURCEREPO ?= https://github.com/libbpf/bpftool.git
###############################################################################
# Building the images
###############################################################################
PLATFORM_ARG=--platform $(DOCKER_PLATFORMS)
image-single-platform:
$(MAKE) image PLATFORM_ARG=
image: register
docker buildx build \
$(PUSH_ARG) \
$(PLATFORM_ARG) \
--build-arg SOURCE_REF=$(SOURCEREF) \
--build-arg SOURCE_REPO=$(SOURCEREPO) \
--tag $(IMAGE) .
push:
$(MAKE) image PUSH_ARG=--push
# Enable support for non-native binaries so that cross-platform builds can be
# done. This is needed for the buildx build command.
# See https://docs.docker.com/build/building/multi-platform/#install-qemu-manually
.PHONY: register
register:
docker run --privileged --rm tonistiigi/binfmt --install all
###############################################################################
# UTs
###############################################################################
test:
docker run --rm $(IMAGE) /bpftool version | grep -q "bpftool v"
@echo "success"
###############################################################################
# CI
###############################################################################
.PHONY: ci
## Run what CI runs
ci: image test
###############################################################################
# CD
###############################################################################
.PHONY: cd
## Deploys images to registry
cd:
ifndef CONFIRM
$(error CONFIRM is undefined - run using make <target> CONFIRM=true)
endif
$(MAKE) push