From 34b31642e3382101228be7196fb9ae93b2ec4695 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 7 May 2026 12:21:54 +0200 Subject: [PATCH] Recompress slim layers to gzip before pushing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `docker save` writes uncompressed layer tarballs (`application/vnd.oci.image.layer.v1.tar`). Pushed as-is, the slim image landed in the registry as a single ~2.56 GB uncompressed blob — larger than the un-slimmed base — so the slim toolkit's size win was being thrown away on the way out. Insert a `regctl image mod --layer-compress gzip --replace` step between import and digest computation so layers are rewritten to `application/vnd.oci.image.layer.v1.tar+gzip` before the push. The digest must be computed after the mod step since recompressing layers changes the manifest digest. --- .github/workflows/postgresql.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/postgresql.yml b/.github/workflows/postgresql.yml index c8d7d37..01df6fe 100644 --- a/.github/workflows/postgresql.yml +++ b/.github/workflows/postgresql.yml @@ -240,8 +240,16 @@ jobs: regctl image import "ocidir:///tmp/slim-oci:slim" /tmp/slim.tar rm /tmp/slim.tar + # docker save writes uncompressed layer tarballs (.tar, not .tar.gzip). + # Pushed as-is the slim image lands in the registry larger than the + # un-slimmed base. Recompress layers to gzip in place so the registry + # blob sizes reflect the slim toolkit's actual size win. + regctl image mod "ocidir:///tmp/slim-oci:slim" \ + --layer-compress gzip --replace + # Compute the manifest digest locally so we can address the registry push - # by digest URL — no tag is created on Docker Hub. + # by digest URL — no tag is created on Docker Hub. Must happen AFTER the + # mod step: recompressing layers changes layer digests → manifest digest. DIGEST="$(regctl manifest digest "ocidir:///tmp/slim-oci:slim")" echo "Slim digest (${{ matrix.arch }}): ${DIGEST}"