From b58609c06b8f037ea9244d40dac572c73b5dd045 Mon Sep 17 00:00:00 2001 From: Arik Hadas Date: Fri, 9 Feb 2024 23:51:50 +0200 Subject: [PATCH] reduce the size of forklift-virt-v2v-stub Signed-off-by: Arik Hadas --- build_tests_bazel.sh | 2 +- stub-images/virt-v2v-stub/BUILD.bazel | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build_tests_bazel.sh b/build_tests_bazel.sh index 559fec9..0e767e7 100755 --- a/build_tests_bazel.sh +++ b/build_tests_bazel.sh @@ -21,5 +21,5 @@ export REGISTRY_TAG=latest # Copy the stub-images under the bazel workspace cp -fr ${SCRIPT_DIR}/stub-images virt-v2v/cold -bazel run --package_path=virt-v2v/cold stub-images:push-forklift-virt-v2v-stub --verbose_failures +bazel run --strategy_regexp="RunAndCommitLayer stub-images/virt-v2v-stub/qemu-img-layer.tar"=processwrapper-sandbox --package_path=virt-v2v/cold stub-images:push-forklift-virt-v2v-stub --verbose_failures bazel run --strategy_regexp="Action stub-images/vddk-test-vmdk/convert_to_vmdk/tmp/cirros.vmdk"=processwrapper-sandbox --package_path=virt-v2v/cold stub-images:push-vddk-test-vmdk --verbose_failures diff --git a/stub-images/virt-v2v-stub/BUILD.bazel b/stub-images/virt-v2v-stub/BUILD.bazel index 9f16be1..6e2f75b 100644 --- a/stub-images/virt-v2v-stub/BUILD.bazel +++ b/stub-images/virt-v2v-stub/BUILD.bazel @@ -2,15 +2,25 @@ load( "@io_bazel_rules_docker//container:container.bzl", "container_image", ) +load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit_layer") + +container_run_and_commit_layer( + name = "qemu-img", + commands = [ + "dnf -y install qemu-img", + ], + image = "@centos-stream-9//image", +) container_image( name = "forklift-virt-v2v-stub", - base = "//:forklift-virt-v2v", + base = "@centos-stream-9//image", directory = "/usr/local/bin/", empty_dirs = ["/disks"], entrypoint = ["/usr/local/bin/entrypoint"], env = {"LIBGUESTFS_BACKEND": "direct"}, files = ["bin/entrypoint"], + layers = [":qemu-img"], user = "1001", visibility = ["//visibility:public"], )