Simplify setting Dockerfile defaults

This commit is contained in:
Ilya Fedin 2023-03-18 00:40:18 +04:00 committed by John Preston
parent 00a237c144
commit 9f34f049ec
1 changed files with 5 additions and 2 deletions

View File

@ -3,10 +3,13 @@ from os import environ
from os.path import dirname
from jinja2 import Environment, FileSystemLoader
def checkEnv(envName, defaultValue):
return bool(len(environ[envName])) if envName in environ else defaultValue
def main():
print(Environment(loader=FileSystemLoader(dirname(__file__))).get_template("Dockerfile").render(
DEBUG=bool(len(environ["DEBUG"])) if "DEBUG" in environ else True,
LTO=bool(len(environ["LTO"])) if "LTO" in environ else True,
DEBUG=checkEnv("DEBUG", True),
LTO=checkEnv("LTO", True),
))
if __name__ == '__main__':