alpine-overlay/Makefile

64 lines
2.6 KiB
Makefile
Raw Normal View History

REGISTRY := public.ecr.aws/zero-downtime
IMAGE := alpine-builder
REGION := us-east-1
include .ci/podman.mk
BUILDER := v3.16.3
2022-03-25 11:06:28 +00:00
PKG := '*'
CF_DIST := E1YFUJXMCXT2RN
BUILDER_RELEASE = $(shell echo $(BUILDER) | sed -e 's/-.*$$//')
RELEASE := $(shell echo $(BUILDER_RELEASE) | sed -e 's/\.[0-9]$$//')
2021-11-12 17:28:59 +00:00
.PHONY: apk aports download upload packages invalidate_cdn
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
2022-03-23 12:23:03 +00:00
packages: reset-permissions
2022-10-03 18:24:01 +00:00
mkdir -p packages/kubezero/aarch64 packages/kubezero/x86_64
2021-11-12 17:28:59 +00:00
distfiles:
mkdir -p distfiles
aports: reset-permissions
@[ -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); }
2021-11-12 17:28:59 +00:00
apk: packages distfiles
podman run -it --rm --platform linux/$(_ARCH) \
2021-11-12 17:28:59 +00:00
-v ${PWD}/distfiles:/var/cache/distfiles \
-v ${PWD}/packages:/home/alpine/packages \
-v ${PWD}/aports:/home/alpine/aports \
2022-10-03 18:24:01 +00:00
-v ${PWD}/kubezero:/home/alpine/kubezero \
2022-03-25 11:06:28 +00:00
-v ${HOME}/.gitconfig/:/home/alpine/.gitconfig:ro \
-v ${HOME}/.abuild/:/home/alpine/.abuild:ro \
$(REGISTRY)/$(IMAGE):$(BUILDER) $(PKG)
reset-permissions:
@[ -d aports ] && doas chown -R $(USER): aports
@[ -d distfiles ] && doas chown -R $(USER): distfiles
@[ -d packages ] && doas chown -R $(USER): packages
@[ -d kubezero ] && doas chown -R $(USER): kubezero
2021-11-12 17:28:59 +00:00
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
2022-10-03 18:24:01 +00:00
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