-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
55 lines (46 loc) · 1.54 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
# Copyright (C) 2019 Richard Mortier <[email protected]>
# Licensed under the MIT License, https://opensource.org/licenses/MIT
.DEFAULT_GOAL := dabuild
ORG = registry.alpinelinux.org/alpine
IMG = $(ORG)/docker-abuild
VOLS = bin etc lib sbin usr var home/builder/.ccache
# BRANCHES := $(shell \
# curl -s https://api.github.com/repos/alpinelinux/aports/branches \
# | jq -r '.[].name' \
# )
# TAGS := $(shell \
# curl -s https://registry.hub.docker.com/v1/repositories/alpine/tags \
# | jq -r '.[].name' \
# )
## let's just manually specify some tags for now
RELEASES ?= v2.6 v2.7 v3.1 v3.2 v3.3 v3.4 v3.5 v3.6 v3.7 v3.8 v3.9 v3.10 v3.11 edge
ARCH := $(shell uname -m)
dabuild: dabuild.in
sed 's!%%ABUILD_VOLUMES%%!$(VOLS)!;s!%%ABUILD_IMAGE%%!$(IMG)!' \
dabuild.in >| dabuild
chmod +x dabuild
.PHONY: all
all: images dabuild
.PHONY: images
images: $(patsubst %, build-%, $(RELEASES))
.PHONY: build-%
build-%:
sed 's!{{tag}}!$(subst v,,$*)!;s!{{release}}!$*!' \
Dockerfile.in >| Dockerfile
# XXX probably because I'm on an edge release of Docker for Mac with a beta
# engine, DOCKER_BUILDKIT appears to have some strange behaviour so turning
# it off for now
DOCKER_BUILDKIT=0 docker build $$DOCKER_FLAGS \
-t $(IMG):$(subst v,,$*) .
$(RM) Dockerfile
.PHONY: push
push:
docker push $(DOCKER_FLAGS) $(IMG)
.PHONY: clean
clean:
docker rmi -f $$(docker images -q $(IMG)) || true
$(RM) Dockerfile dabuild
.PHONY: distclean
distclean: clean
docker rmi -f $$(docker images -q $(IMG)) || true
docker rmi $$(docker volume ls --filter 'name=alpine-' -q) || true