summaryrefslogtreecommitdiff
path: root/Makefile
blob: 86ce723c220d164e62231cdee52e34c129ae6ea2 (plain)
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
# ============================================================ BUILD OPTIONS ==

# path to build aports directory
OUT      := ./out

# signing key for each package
KEY      := aports.rsa
KEY_PUB  := aports.rsa.pub

# name of docker image
IMAGE    := g.freya.cat/freya/aports

# alpine version to build the packages on
ALPINE_VERSION := 3.22

# order of packages to build
APORTS   := apk-conf \
			caddy-conf \
			openssh-conf \
			tmux-conf \
			zsh-conf \
			freya-certs \
			freya-keys \
			freya-base

# location to publish aports
REPO     := shun.freya.cat:/static/cdn/

# =============================================================================

.PHONY: publish aports image clean realclean ALWAYS

# docker run arguments
DOCKER_ARGS := -v ./aports:/aports \
			   -v $(OUT):/home/builder/packages \
			   -v ./$(KEY):/etc/apk/keys/$(KEY) \
			   -v ./$(KEY_PUB):/etc/apk/keys/$(KEY_PUB) \
				--ulimit "nofile=1024:1048576" \
				-e PACKAGER_PRIVKEY=/etc/apk/keys/$(KEY) \
				-e APORTS="$(APORTS)" \
				$(IMAGE)

# docker run command
DOCKER := docker run --rm -it $(DOCKER_ARGS)

aports: image $(KEY) clean ALWAYS
	mkdir -p $(OUT)/aports
	$(DOCKER) /bin/aports-build
	cp $(KEY_PUB) $(OUT)/aports

image: Dockerfile
	docker build . \
		--build-arg "UID=$(shell id -u)" \
		--build-arg "GID=$(shell id -g)" \
		--build-arg "ALPINE_VERSION=$(ALPINE_VERSION)" \
		-t $(IMAGE)

$(KEY):
	touch $(KEY) $(KEY_PUB)
	$(DOCKER) /bin/aports-keygen

clean:
	rm -fr $(OUT)
	rm -fr $(patsubst %,./aports/%/src,$(APORTS))

realclean: clean
	rm -f $(KEY) $(KEY_PUB)
	docker image rm $(IMAGE)

all: aports publish

publish:
	rsync -avz --delete $(OUT)/aports/* $(REPO)/aports/