Add Debian archive date when building image

This commit is contained in:
Alex Pyrgiotis 2025-02-06 14:22:17 +02:00
parent 04559863b7
commit e1b5a1140a
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -88,6 +88,11 @@ def main():
default=None, default=None,
help="Provide a custom tag for the image (for development only)", help="Provide a custom tag for the image (for development only)",
) )
parser.add_argument(
"--debian-archive-date",
default=None,
help="Use a specific Debian snapshot archive, by its date",
)
args = parser.parse_args() args = parser.parse_args()
tarball_path = Path("share") / "container.tar.gz" tarball_path = Path("share") / "container.tar.gz"
@ -97,6 +102,12 @@ def main():
tag = args.tag or determine_git_tag() tag = args.tag or determine_git_tag()
image_name_tagged = IMAGE_NAME + ":" + tag image_name_tagged = IMAGE_NAME + ":" + tag
build_args = []
if args.debian_archive_date:
print(f"Using Debian archive snapshot date '{args.debian_archive_date}'")
build_args = ["--build-arg", f"DEBIAN_ARCHIVE_DATE={args.debian_archive_date}"]
image_name_tagged = "f{args.debian_archive_date}-{image_name_tagged}"
print(f"Will tag the container image as '{image_name_tagged}'") print(f"Will tag the container image as '{image_name_tagged}'")
with open(image_id_path, "w") as f: with open(image_id_path, "w") as f:
@ -111,6 +122,7 @@ def main():
args.runtime, args.runtime,
"build", "build",
BUILD_CONTEXT, BUILD_CONTEXT,
*build_args,
*cache_args, *cache_args,
*platform_args, *platform_args,
"-f", "-f",