Skip to content
Snippets Groups Projects
Commit 9afb69c8 authored by Jenkins's avatar Jenkins Committed by Gerrit Code Review
Browse files

Merge "Mechanism for Dockerfile customization"

parents 019db8bb 51074b0a
No related branches found
No related tags found
No related merge requests found
......@@ -142,6 +142,8 @@ _CLI_OPTS = [
help=("Don't build images. Generate Dockerfile only")),
cfg.IntOpt('timeout', default=120,
help='Time in seconds after which any operation times out'),
cfg.StrOpt('template-override',
help='Path to template override file'),
]
_BASE_OPTS = [
......
......@@ -613,9 +613,6 @@ class KollaWorker(object):
self.base)
for path in self.docker_build_paths:
template_name = "Dockerfile.j2"
env = jinja2.Environment( # nosec: not used to render HTML
loader=jinja2.FileSystemLoader(path))
template = env.get_template(template_name)
values = {'base_distro': self.base,
'base_image': self.conf.base_image,
'base_distro_tag': self.base_tag,
......@@ -628,6 +625,16 @@ class KollaWorker(object):
'maintainer': self.maintainer,
'kolla_version': kolla_version,
'rpm_setup': self.rpm_setup}
env = jinja2.Environment( # nosec: not used to render HTML
loader=jinja2.FileSystemLoader(path))
template = env.get_template(template_name)
if self.conf.template_override:
template_path = os.path.dirname(self.conf.template_override)
template_name = os.path.basename(self.conf.template_override)
values['parent_template'] = template
env = jinja2.Environment( # nosec: not used to render HTML
loader=jinja2.FileSystemLoader(template_path))
template = env.get_template(template_name)
if self.include_header:
with open(self.include_header, 'r') as f:
values['include_header'] = f.read()
......
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