-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (72 loc) · 2.22 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#
CROSS := cross
DOCKER := docker
ECHO := echo
PROJECT := docker-mdns
# The version of Debian used in the final generated images
DOCKER_BASE_IMAGE := debian:bookworm-20231030-slim
DOCKERFILE := docker/Dockerfile
# AARCH64
ARCH_AARCH64 := arm64
AARCH64 := aarch64
DOCKER_IMAGE_ARCH_AARCH64 := arm64/v8
PLATFORM_AARCH64 := aarch64
TARGET_AARCH64 := aarch64-unknown-linux-gnu
# AMD64
ARCH_AMD64 := amd64
AMD64 := amd64
DOCKER_IMAGE_ARCH_AMD64 := amd64
PLATFORM_AMD64 := amd64
TARGET_AMD64 := x86_64-unknown-linux-gnu
# ARMv7
ARCH_ARMV7 := armhf
ARMV7 := armv7
DOCKER_IMAGE_ARCH_ARMV7 := arm/v7
PLATFORM_ARMV7 := arm/v7
TARGET_ARMV7 := $(ARMV7)-unknown-linux-gnueabihf
target/$(TARGET_ARMV7)/release/docker-mdns:
@$(CROSS) build \
--release \
--target=$(TARGET_ARMV7)
.PHONY: imagearmv7
imagearmv7: target/$(TARGET_ARMV7)/release/docker-mdns
@$(ECHO) "Building $(PROJECT) image"
@$(DOCKER) buildx build \
--build-arg BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg IMAGE_ARCH=$(DOCKER_IMAGE_ARCH_ARMV7) \
--build-arg TARGET=$(TARGET_ARMV7) \
--file $(DOCKERFILE) \
--platform linux/$(DOCKER_IMAGE_ARCH_ARMV7) \
--tag docker-mdns:$(ARMV7) \
.
target/$(TARGET_AMD64)/release/docker-mdns:
@$(CROSS) build \
--release \
--target=$(TARGET_AMD64)
.PHONY: imageamd64
imageamd64: target/$(TARGET_AMD64)/release/docker-mdns
@$(ECHO) "Building $(PROJECT) image for $(PLATFORM_AMD64)"
@$(ECHO) "Image platform: $(DOCKER_IMAGE_ARCH_AMD64)"
@$(DOCKER) buildx build \
--build-arg BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg IMAGE_ARCH=$(DOCKER_IMAGE_ARCH_AMD64) \
--build-arg TARGET=$(TARGET_AMD64) \
--file $(DOCKERFILE) \
--platform linux/$(DOCKER_IMAGE_ARCH_AMD64) \
--tag docker-mdns:$(AMD64) \
.
target/$(TARGET_AARCH64)/release/docker-mdns:
@$(CROSS) build \
--release \
--target=$(TARGET_AARCH64)
.PHONY: imageaarch64
imageaarch64: target/$(TARGET_AARCH64)/release/docker-mdns
@$(ECHO) "Building $(PROJECT) image for $(PLATFORM_AARCH64)"
$(DOCKER) buildx build \
--build-arg BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg IMAGE_ARCH=$(DOCKER_IMAGE_ARCH_AARCH64) \
--build-arg TARGET=$(TARGET_AARCH64) \
--file $(DOCKERFILE) \
--platform linux/$(DOCKER_IMAGE_ARCH_AARCH64) \
--tag docker-mdns:$(AARCH64) \
.