in dockerfiles.py [0:0]
def load_template(env: Environment, template_path: str) -> Template:
"""
Load a Jinja2 template from the given path using the provided environment.
Args:
env (Environment): The Jinja2 environment to use.
template_path (str): The file path of the template.
Returns:
Template: The loaded Jinja2 template object.
Raises:
SystemExit: If the template cannot be loaded.
"""
try:
return env.get_template(template_path)
except Exception as e:
logger.error("Error loading template '%s': %s", template_path, e)
sys.exit(1)