Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GHA] Using zstd compression for container images and their build caches (#34333)

Andrey Babushkina955997e426c
diff --git a/.github/actions/handle_docker/images_api.py b/.github/actions/handle_docker/images_api.py
index 868ed378576..62899f9ff5e 100644
--- a/.github/actions/handle_docker/images_api.py
+++ b/.github/actions/handle_docker/images_api.py
@@ -54,17 +54,23 @@ class Image:
cache_cmd += f"--cache-from type=registry,ref={self.base_ref()}-cache "
if export_cache:
- cache_cmd += f"--cache-to type=registry,ref={self.ref()}-cache,mode=max "
+ cache_cmd += f"--cache-to type=registry,ref={self.ref()}-cache,"
+ cache_cmd += "mode=max,compression=zstd,compression-level=22,"
+ cache_cmd += "force-compression=true,oci-mediatypes=true "
- build_cmd = f"docker buildx build --builder={docker_builder}" if docker_builder else "docker build"
- push_cmd = f"--push" if push else ""
+ build_cmd = f"docker buildx build --builder={docker_builder}"
+
+ output = f"--output type=image,compression=zstd,compression-level=22,"
+ output += "force-compression=true,oci-mediatypes=true"
+ output += f",name={self.ref()}"
+ output += ",push=true" if push else ""
cmd = f"{build_cmd} " \
f"--file {self.dockerfile} " \
f"--tag {self.ref()} " \
f"--build-arg REGISTRY={self.registry}/dockerio " \
f"{cache_cmd} " \
- f"{push_cmd} " \
+ f"{output} " \
"."
run(cmd, dry)
diff --git a/.github/dockerfiles/docker_tag b/.github/dockerfiles/docker_tag
index 37bc84c96d0..9ad2b2e04f5 100644
--- a/.github/dockerfiles/docker_tag
+++ b/.github/dockerfiles/docker_tag
@@ -1 +1 @@
-pr-34222
+pr-34333