Skip to content
Snippets Groups Projects
Commit ba398d43 authored by Lars Bilke's avatar Lars Bilke
Browse files

Added enroot support.

-E option for converting to enroot squashfs image
--enroot_file for specifying filename
parent 56dcaa7d
No related branches found
No related tags found
1 merge request!1Added enroot support.
......@@ -51,14 +51,24 @@ class builder(object):
if self.__args.upload:
subprocess.run(f"docker push {self.__tag}", shell=True)
image_base_name = f"{self.__images_out_dir}/{self.__img_file}-{image_id_short}"
if self.__args.sif_file:
self.image_file = f"{self.__images_out_dir}/{self.__args.sif_file}"
else:
self.image_file = (
f"{self.__images_out_dir}/{self.__img_file}-{image_id_short}.sif"
)
self.image_file = f"{image_base_name}.sif"
if self.__args.convert and not os.path.exists(self.image_file):
subprocess.run(
f"cd {self.__cwd} && singularity build --force {self.image_file} docker-daemon:{self.__tag}",
shell=True,
)
if self.__args.enroot_file:
self.image_file = f"{self.__images_out_dir}/{self.__args.enroot_file}"
else:
self.image_file = f"{image_base_name}.sqsh"
if self.__args.convert_enroot and not os.path.exists(self.image_file):
subprocess.run(
f"cd {self.__cwd} && ENROOT_SQUASH_OPTIONS='-comp lz4 -noD' enroot import -o {self.image_file} dockerd://{self.__tag}",
shell=True,
)
print(f"Wrote image file {self.image_file}")
......@@ -44,6 +44,12 @@ def main(): # pragma: no cover
default="",
help="Overwrite output singularity image file name",
)
parser.add_argument(
"--enroot_file",
type=str,
default="",
help="Overwrite output enroot image file name",
)
parser.add_argument(
"--print",
"-P",
......@@ -103,6 +109,13 @@ def main(): # pragma: no cover
action="store_true",
help="Convert Docker image to Singularity image",
)
build_g.add_argument(
"--convert-enroot",
"-E",
dest="convert_enroot",
action="store_true",
help="Convert Docker image to enroot image",
)
build_g.add_argument(
"--runtime-only",
"-R",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment