diff --git a/dev_scripts/reproduce-image.py b/dev_scripts/reproduce-image.py index 5c7aa77..48bfb82 100755 --- a/dev_scripts/reproduce-image.py +++ b/dev_scripts/reproduce-image.py @@ -114,9 +114,9 @@ def diffoci_download(): DIFFOCI_PATH.chmod(DIFFOCI_PATH.stat().st_mode | stat.S_IEXEC) -def diffoci_diff(source, local_target): +def diffoci_diff(runtime, source, local_target): """Diff the source image against the recently built target image using diffoci.""" - target = f"podman://{local_target}" + target = f"{runtime}://{local_target}" try: return run( str(DIFFOCI_PATH), @@ -150,12 +150,18 @@ def parse_args(): image_tag = git_determine_tag() # TODO: Remove the local "podman://" prefix once we have started pushing images to a # remote. - default_image_name = f"podman://{IMAGE_NAME}:{image_tag}" + default_image_name = f"{IMAGE_NAME}:{image_tag}" parser = argparse.ArgumentParser( prog=sys.argv[0], description="Dev script for verifying container image reproducibility", ) + parser.add_argument( + "--runtime", + choices=["docker", "podman"], + default=CONTAINER_RUNTIME, + help=f"The container runtime for building the image (default: {CONTAINER_RUNTIME})", + ) parser.add_argument( "--source", default=default_image_name, diff --git a/install/common/build-image.py b/install/common/build-image.py index 91fe79c..33dea0b 100644 --- a/install/common/build-image.py +++ b/install/common/build-image.py @@ -58,6 +58,11 @@ def main(): default=CONTAINER_RUNTIME, help=f"The container runtime for building the image (default: {CONTAINER_RUNTIME})", ) + parser.add_argument( + "--platform", + default=None, + help=f"The platform for building the image (default: current platform)", + ) parser.add_argument( "--no-save", action="store_true", @@ -100,12 +105,14 @@ def main(): # Build the container image, and tag it with the calculated tag print("Building container image") cache_args = [] if args.use_cache else ["--no-cache"] + platform_args = [] if not args.platform else ["--platform", args.platform] subprocess.run( [ args.runtime, "build", BUILD_CONTEXT, *cache_args, + *platform_args, "-f", "Dockerfile", "--tag",