Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (47 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
60 lines (47 loc) · 1.5 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
REGISTRY_IMAGE ?= ghcr.io/markentier/utilities
export DOCKER_BUILDKIT = 1
# either of: linux/amd64, linux/arm64
DOCKER_BUILD_PLATFORM ?= linux/amd64
BUILDX_FLAGS ?=
# all-in-one must come last, as it depends on the other images
PROJECTS = \
magicpak \
upx \
sccache \
busybox \
all-in-one
default:
@echo "Usage: make image <utility name> - build a single utility image"
@echo "Usage: make all - build all utility images and the all-in-one image"
### remote registry - multi-platform image builds
image.ghcr:
docker buildx build \
--progress=plain \
--build-arg REGISTRY_IMAGE=$(REGISTRY_IMAGE) \
--build-arg UTILITY_IMAGE=$(UTILITY_IMAGE) \
--build-arg UTILITY_VERSION=$(UTILITY_VERSION) \
--tag $(REGISTRY_IMAGE):$(UTILITY_IMAGE) \
--platform linux/amd64,linux/arm64 \
$(BUILDX_FLAGS) \
--output=type=registry .
all.ghcr:
rootdir=$$(pwd); \
for project in $(PROJECTS); do \
cd $$rootdir/utilities/$$project; \
$(MAKE) image.ghcr; \
done
login:
@echo $(GHCR_PAT) | docker login ghcr.io -u asaaki --password-stdin
### local - only single platform, as docker does not support multi-platform images locally
image:
docker build \
--progress plain \
--platform $(DOCKER_BUILD_PLATFORM) \
--build-arg REGISTRY_IMAGE=$(REGISTRY_IMAGE) \
--build-arg UTILITY_IMAGE=$(UTILITY_IMAGE) \
--build-arg UTILITY_VERSION=$(UTILITY_VERSION) \
-t $(REGISTRY_IMAGE):$(UTILITY_IMAGE) .
all: $(PROJECTS)
$(PROJECTS): %:
cd utilities/$@ && \
$(MAKE) image DOCKER_BUILD_PLATFORM=$(DOCKER_BUILD_PLATFORM)