alpine-overlay/Makefile

65 lines
2.7 KiB
Makefile

REGISTRY := public.ecr.aws/zero-downtime
IMAGE := alpine-builder
REGION := us-east-1
# Also tag builder images as latest major version
EXTRA_TAGS = $(shell echo $(GIT_TAG) | awk -F '.' '{ print $$1 "." $$2 }')
include .ci/podman.mk
PKG := '*'
CF_DIST := E11OFTOA3L8IVY
ALPINE_RELEASE = $(shell echo $(GIT_TAG) | sed -e 's/-.*$$//')
ALPINE_MAJOR := $(shell echo $(ALPINE_RELEASE) | sed -e 's/\.[0-9]$$//')
.PHONY: aarch64-toolchain packages distfiles aports apk init_apk_repo
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 $(ALPINE_RELEASE); }
[ -d aports/.git ] || { git clone https://gitlab.alpinelinux.org/alpine/aports.git && \
cd aports && git checkout $(ALPINE_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):$(ALPINE_RELEASE) $(PKG)
download:
aws s3 sync s3://zero-downtime-web-cdn/alpine/$(ALPINE_MAJOR)/kubezero/x86_64/ packages/kubezero/x86_64/ --exclude APKINDEX.tar.gz
#aws s3 sync s3://zero-downtime-web-cdn/alpine/$(ALPINE_MAJOR)/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/$(ALPINE_MAJOR)/kubezero/x86_64/ --exclude APKINDEX.tar.gz
#aws s3 sync --delete packages/kubezero/aarch64/ s3://zero-downtime-web-cdn/alpine/$(ALPINE_MAJOR)/kubezero/aarch64/ --exclude APKINDEX.tar.gz
aws s3 cp packages/kubezero/x86_64/APKINDEX.tar.gz s3://zero-downtime-web-cdn/alpine/$(ALPINE_MAJOR)/kubezero/x86_64/ --cache-control max-age=1
#aws s3 cp packages/kubezero/aarch64/APKINDEX.tar.gz s3://zero-downtime-web-cdn/alpine/$(ALPINE_MAJOR)/kubezero/aarch64/ --cache-control max-age=1
init_apk_repo:
aws s3 cp s3://zero-downtime-web-cdn/alpine/v3.19/kubezero/x86_64/APKINDEX.tar.gz s3://zero-downtime-web-cdn/alpine/$(ALPINE_MAJOR)/kubezero/x86_64/APKINDEX.tar.gz