-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (52 loc) · 2.79 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.PHONY: help build push_images create_manifest build_amd64 build_arm64 build_armv6 build_armv7 build_ppc64le build_s390x
.DEFAULT_GOAL := help
SHELL = /bin/sh
BUILD_DIR = build
ARCHITECTURES = amd64 arm64 arm/v6 arm/v7 s390x ppc64le
BRANCH = $(shell git branch --show-current)
ifeq ($(BRANCH),main)
IMAGE_TAG = latest
else
IMAGE_TAG = $(BRANCH)
endif
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z0-9_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help: ## Displays this message.
@echo "Please use \`make <target>\` where <target> is one of:"
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
build_amd64: ## Builds the Docker image for amd64
docker build -t ${USER}/altair-mpm:${IMAGE_TAG}-amd64 --provenance false --platform=linux/amd64 --file ./Dockerfile --progress plain .
build_arm64: ## Builds the Docker image for arm64
docker build -t ${USER}/altair-mpm:${IMAGE_TAG}-arm64 --provenance false --platform=linux/arm64 --file ./Dockerfile --progress plain .
build_armv6: ## Builds the Docker image for armv6
docker build -t ${USER}/altair-mpm:${IMAGE_TAG}-armv6 --provenance false --platform=linux/arm/v6 --file ./Dockerfile --progress plain .
build_armv7: ## Builds the Docker image for armv7
docker build -t ${USER}/altair-mpm:${IMAGE_TAG}-armv7 --provenance false --platform=linux/arm/v7 --file ./Dockerfile --progress plain .
build_ppc64le: ## Builds the Docker image for ppc64le
docker build -t ${USER}/altair-mpm:${IMAGE_TAG}-ppc64le --provenance false --platform=linux/ppc64le --file ./Dockerfile --progress plain .
build_s390x: ## Builds the Docker image for s390x
docker build -t ${USER}/altair-mpm:${IMAGE_TAG}-s390x --provenance false --platform=linux/s390x --file ./Dockerfile --progress plain .
build: build_amd64 build_arm64 build_armv6 build_armv7 build_ppc64le build_s390x ## Builds the Docker images
push_images: build ## Uploads the local docker images
docker image push ${USER}/altair-mpm:${IMAGE_TAG}-amd64
docker image push ${USER}/altair-mpm:${IMAGE_TAG}-arm64
docker image push ${USER}/altair-mpm:${IMAGE_TAG}-armv6
docker image push ${USER}/altair-mpm:${IMAGE_TAG}-armv7
docker image push ${USER}/altair-mpm:${IMAGE_TAG}-s390x
docker image push ${USER}/altair-mpm:${IMAGE_TAG}-ppc64le
create_manifest: push_images ## Uploads the manifest
docker manifest create ${USER}/altair-mpm:${IMAGE_TAG} \
--amend ${USER}/altair-mpm:${IMAGE_TAG}-amd64 \
--amend ${USER}/altair-mpm:${IMAGE_TAG}-arm64 \
--amend ${USER}/altair-mpm:${IMAGE_TAG}-armv6 \
--amend ${USER}/altair-mpm:${IMAGE_TAG}-armv7 \
--amend ${USER}/altair-mpm:${IMAGE_TAG}-s390x \
--amend ${USER}/altair-mpm:${IMAGE_TAG}-ppc64le
docker manifest push ${USER}/altair-mpm:${IMAGE_TAG}