Allow overriding jobs count in Dockerfile

This commit is contained in:
Ilya Fedin 2025-06-06 06:45:43 +00:00 committed by John Preston
parent 307a7791df
commit 0c635a05ff
2 changed files with 5 additions and 2 deletions

View file

@ -48,7 +48,7 @@ ENV LDFLAGS='{% if not LTO %}-fuse-ld=lld{% endif %} -static-libstdc++ -static-l
ENV CMAKE_GENERATOR=Ninja
ENV CMAKE_BUILD_TYPE=None
ENV CMAKE_BUILD_PARALLEL_LEVEL=
ENV CMAKE_BUILD_PARALLEL_LEVEL='{{ JOBS }}'
RUN git init Implib.so \
&& cd Implib.so \

View file

@ -4,12 +4,15 @@ 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
if isinstance(defaultValue, bool):
return bool(len(environ[envName])) if envName in environ else defaultValue
return environ[envName] if envName in environ else defaultValue
def main():
print(Environment(loader=FileSystemLoader(dirname(__file__))).get_template("Dockerfile").render(
DEBUG=checkEnv("DEBUG", True),
LTO=checkEnv("LTO", True),
JOBS=checkEnv("JOBS", ""),
))
if __name__ == '__main__':