forked from jpillora/docker-dnsmasq
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
GNUmakefile
59 lines (49 loc) · 1.93 KB
/
GNUmakefile
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
# Official and semi-official architectures: https://github.com/docker-library/official-images#architectures-other-than-amd64
# Webproc for linux is available for amd64, i386, arm and arm64
# Docker's names for these are (linux/...) amd64 arm/v7 i386 arm64
ARCHITECTURES=amd64 arm/v7 i386 arm64
DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/i386,linux/arm64
IMAGE_NAME=outlyernet/dnsmasq-multiarch
VERSIONS=$(shell ./get_versions.bash)
TIMESTAMP=$(shell date +%Y%m%d)
# Figure the versions
all: build $(ARCHITECTURES)
build:
@# Build and set the multiplatform tag
docker buildx build \
--platform $(DOCKER_PLATFORMS) \
--tag $(IMAGE_NAME):latest \
--tag $(IMAGE_NAME):$(VERSIONS) \
--tag $(IMAGE_NAME):$(TIMESTAMP) \
.
# Note: Passing --load to make it easier to debug, with it they are
# made available in the (local) docker server instead of remaining
# "hidden" in the build cache (this can't be applied to the manifest
# list (i.e. the multiarch tag)
# "Build" per-platform to tag, since latest-$ARCHITECTURE used to be provided
$(ARCHITECTURES):
@# The subst below replaces arm/v7 since that's not a valid tag name
docker buildx build --load \
--platform linux/$@ \
--tag $(IMAGE_NAME):latest-$(subst arm/v7,armv7,$@) \
--tag $(IMAGE_NAME):$(VERSIONS)-$(subst arm/v7,armv7,$@) \
--tag $(IMAGE_NAME):$(TIMESTAMP)-$(subst arm/v7,armv7,$@) \
.
# Repository-specific stuff. Can only be used as-is by me
push:
docker buildx build --push \
--platform $(DOCKER_PLATFORMS) \
--tag $(IMAGE_NAME):latest \
--tag $(IMAGE_NAME):$(VERSIONS) \
--tag $(IMAGE_NAME):$(TIMESTAMP) \
.
for arch in $(ARCHITECTURES); do \
archtag=`echo $$arch | sed 's!arm/v7!armv7!'` ; \
docker buildx build --push \
--platform linux/$$arch \
--tag $(IMAGE_NAME):latest-$$archtag \
--tag $(IMAGE_NAME):$(VERSIONS)-$$archtag \
--tag $(IMAGE_NAME):$(TIMESTAMP)-$$archtag \
. ; \
done
.PHONY: all build push $(ARCHITECTURES)