Add container tag setup

This commit is contained in:
Aurelien Vaillant
2022-04-15 11:37:34 +02:00
parent 12b0039d2a
commit 18488da8d5
2 changed files with 12 additions and 6 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ from utils.properties import ContainerObject
class Container(enum.Enum): class Container(enum.Enum):
"""Enumerate about the Geometry node""" """Enumerate about the Geometry node"""
BLENDER = ContainerObject(name='Blender', image='stilobique/blender') BLENDER = ContainerObject(name='Blender', image='stilobique/blender', tag='3.1.2')
def launch_unit_test(test: [str] = None): def launch_unit_test(test: [str] = None):
+9 -3
View File
@@ -6,21 +6,27 @@ from pathlib import PurePosixPath
class ContainerObject(object): class ContainerObject(object):
"""All data request to launch one dedicated container""" """All data request to launch one dedicated container"""
def __init__(self, name: str, image: str): def __init__(self, name: str, image: str, tag: str = None):
self.label: str = name.lower() self.label: str = name.lower()
self.image: str = image self.image: str = image
self.tag: str = self.set_tag() self.tag: str = self.set_tag(tag)
self.local_folder: str = '' self.local_folder: str = ''
self.volumes: list[str] = self.set_volumes() self.volumes: list[str] = self.set_volumes()
self.environments: list[str] = self.set_environments() self.environments: list[str] = self.set_environments()
self.commands: list[str] = self.set_commands() self.commands: list[str] = self.set_commands()
self.ref = f'{self.image}:{self.tag}' self.ref = f'{self.image}:{self.tag}'
def set_tag(self): def set_tag(self, tag):
"""Determine the tag use with the docker image call""" """Determine the tag use with the docker image call"""
if 'blender' in self.label: if 'blender' in self.label:
if tag is not None:
return tag
else:
return 'latest' return 'latest'
elif 'unreal' in self.label: elif 'unreal' in self.label:
if tag is not None:
return tag
else:
return 'dev-slim-4.27.2' return 'dev-slim-4.27.2'
else: else:
return None return None