alpine-overlay/Makefile

60 lines
2.4 KiB
Makefile

REGISTRY := public.ecr.aws/zero-downtime
IMAGE := alpine-builder
REGION := us-east-1
include .ci/podman.mk
BUILDER := v3.16.3
PKG := '*'
CF_DIST := E1YFUJXMCXT2RN
BUILDER_RELEASE = $(shell echo $(BUILDER) | sed -e 's/-.*$$//')
RELEASE := $(shell echo $(BUILDER_RELEASE) | sed -e 's/\.[0-9]$$//')
.PHONY: aarch64-toolchain packages distfiles aports apk
aarch64-toolchain:
podman run -it --rm \
-v ${PWD}/distfiles:/var/cache/distfiles \
-v ${PWD}/packages:/home/alpine/packages \
-v ${PWD}/aports:/home/alpine/aports \
-v ${HOME}/.gitconfig/:/home/alpine/.gitconfig:ro \
-v ${HOME}/.abuild/:/home/alpine/.abuild:ro \
$(REGISTRY)/$(IMAGE):$(TAG) aarch64-toolchain
packages:
mkdir -p packages/kubezero/aarch64 packages/kubezero/x86_64
distfiles:
mkdir -p distfiles
aports:
[ -d aports/.git ] && { cd aports; git pull origin $(BUILDER_RELEASE); }
[ -d aports/.git ] || { git clone https://gitlab.alpinelinux.org/alpine/aports.git && \
cd aports && git checkout $(BUILDER_RELEASE); }
apk: packages distfiles
podman run -it --rm --platform linux/$(_ARCH) \
--userns=keep-id:uid=1000,gid=1000 \
-v ${PWD}/distfiles:/var/cache/distfiles \
-v ${PWD}/packages:/home/alpine/packages \
-v ${PWD}/aports:/home/alpine/aports \
-v ${PWD}/kubezero:/home/alpine/kubezero \
-v ${HOME}/.gitconfig/:/home/alpine/.gitconfig:ro \
-v ${HOME}/.abuild/:/home/alpine/.abuild:ro \
--env DEBUG=$(DEBUG) \
$(REGISTRY)/$(IMAGE):$(BUILDER) $(PKG)
download:
aws s3 sync s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/x86_64/ packages/kubezero/x86_64/ --exclude APKINDEX.tar.gz
aws s3 sync s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/aarch64/ packages/kubezero/aarch64/ --exclude APKINDEX.tar.gz
invalidate_cdn:
aws cloudfront create-invalidation --distribution $(CF_DIST) --paths "/alpine/*"
upload: invalidate_cdn
aws s3 sync --delete packages/kubezero/x86_64/ s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/x86_64/ --exclude APKINDEX.tar.gz
aws s3 sync --delete packages/kubezero/aarch64/ s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/aarch64/ --exclude APKINDEX.tar.gz
aws s3 cp packages/kubezero/x86_64/APKINDEX.tar.gz s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/x86_64/ --cache-control max-age=1
aws s3 cp packages/kubezero/aarch64/APKINDEX.tar.gz s3://zero-downtime-web/cdn/alpine/$(RELEASE)/kubezero/aarch64/ --cache-control max-age=1