summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile85
1 files changed, 70 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 9e9fba3..0518b88 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,72 @@
-include ./build.env
-OUT=./out
+# ============================================================ BUILD OPTIONS ==
-.PHONY: build
+# path to build aports directory
+OUT := ./out
-build:
- mkdir -p $(OUT)
- chown 1000:1000 $(OUT)
- docker build -t g.freya.cat/freya/aports .
- docker run --rm -it \
- -v $(shell pwd)/freya:/aports \
- -v $(OUT):/home/user/packages \
- -v $(KEY):/key \
- -v $(KEY_PUB):/key.pub \
- -e PACKAGER_PRIVKEY=/key \
- --ulimit "nofile=1024:1048576" \
- g.freya.cat/freya/aports
+# 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 \
+ 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:
+ scp -r $(OUT)/aports/ $(REPO)