image: debian/testing
packages:
- buildah
- podman
- binfmt-support
- qemu-user-static
secrets:
- 53238824-89f5-4c14-bd90-5e1be107dd85
environment:
REPO_NAME: weatherlink-mqtt
IMAGE_NAME: ghcr.io/nickbp/weatherlink-mqtt
IMAGE_PLATFORMS: linux/amd64
BUILDAH_FORMAT: docker tasks:
- docker: |
# required to fix errors like "potentially insufficient UIDs or GIDs available in user namespace"
sudo touch /etc/subuid /etc/subgid
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER
cd $REPO_NAME/
GIT_REV="$(git rev-parse --short HEAD)"
# build amd64+arm64 images to named manifest. requires buildah >=1.23.1 and takes a long time
# see also https://podman.io/blogs/2021/10/11/multiarch.html
buildah build --manifest "${REPO_NAME}_${GIT_REV}" --jobs=1 --platform="${IMAGE_PLATFORMS}" .
# push manifest and built amd64+arm64 images to both rev and branch tags
buildah manifest push --all "${REPO_NAME}_${GIT_REV}" "docker://${IMAGE_NAME}:${GIT_REV}"