Build with buildah instead of docker: containerd snapshotter can't handle OSTree base layers
Some checks failed
Build KAMOS images / Build kamos (push) Failing after 3h0m3s
Build KAMOS images / Build kamos-nvidia (push) Failing after 3h0m7s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kmk1971 2026-07-30 17:36:19 +04:00
parent fcdbca3033
commit 09f250c87e

View file

@ -35,25 +35,38 @@ jobs:
echo "IMAGE=${REGISTRY_HOST}/${GITHUB_REPOSITORY_OWNER,,}/${{ matrix.image_name }}" >> "$GITHUB_ENV" echo "IMAGE=${REGISTRY_HOST}/${GITHUB_REPOSITORY_OWNER,,}/${{ matrix.image_name }}" >> "$GITHUB_ENV"
echo "DATE_TAG=$(date +%Y%m%d)" >> "$GITHUB_ENV" echo "DATE_TAG=$(date +%Y%m%d)" >> "$GITHUB_ENV"
- name: Build image (uses host Docker via mounted socket) # Docker's builder cannot handle Bazzite's OSTree base image (millions of
# hardlinks break the containerd snapshotter), so the build runs inside a
# buildah container instead — the same tool Bazzite itself is built with.
- name: Build and push with buildah
run: | run: |
docker build \ docker volume create kamos-buildah-cache >/dev/null 2>&1 || true
-f Containerfile \ tar -cf - . | docker run --rm -i --privileged \
--build-arg BASE_IMAGE="${{ matrix.base_image }}" \ -v kamos-buildah-cache:/var/lib/containers \
--build-arg BASE_TAG=stable \ -e IMAGE="${IMAGE}" \
-t "${IMAGE}:stable" \ -e DATE_TAG="${DATE_TAG}" \
-t "${IMAGE}:latest" \ -e BASE_IMAGE="${{ matrix.base_image }}" \
-t "${IMAGE}:${DATE_TAG}" \ -e RUSER="${{ secrets.REGISTRY_USER }}" \
. -e RTOKEN="${{ secrets.REGISTRY_TOKEN }}" \
quay.io/buildah/stable:latest \
bash -c '
set -euo pipefail
mkdir -p /src && tar -xf - -C /src && cd /src
buildah build -f Containerfile \
--build-arg BASE_IMAGE="$BASE_IMAGE" \
--build-arg BASE_TAG=stable \
-t "$IMAGE:stable" .
buildah tag "$IMAGE:stable" "$IMAGE:latest" "$IMAGE:$DATE_TAG"
for tag in stable latest "$DATE_TAG"; do
buildah push --creds "$RUSER:$RTOKEN" "$IMAGE:$tag" "docker://$IMAGE:$tag"
done
'
- name: Push to Forgejo container registry - name: Clean up (keep server disk healthy)
run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | \
docker login "${REGISTRY_HOST}" -u "${{ secrets.REGISTRY_USER }}" --password-stdin
for tag in stable latest "${DATE_TAG}"; do
docker push "${IMAGE}:${tag}"
done
- name: Clean up build cache (keep server disk healthy)
if: always() if: always()
run: docker image prune -f run: |
# The failed docker-builder attempts left ~40 GB of unusable Bazzite
# layers in Docker's store — reclaim them; buildah has its own cache.
docker rmi ghcr.io/ublue-os/bazzite:stable ghcr.io/ublue-os/bazzite-nvidia:stable 2>/dev/null || true
docker image prune -f
docker builder prune -af || true