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

Merge "Add custom code to base docker templates"

parents 576bdb0b 598fe7ba
No related branches found
No related tags found
No related merge requests found
FROM {{ base_distro }}:{{ base_distro_tag }} FROM {{ base_distro }}:{{ base_distro_tag }}
MAINTAINER Kolla Project (https://launchpad.net/kolla) MAINTAINER Kolla Project (https://launchpad.net/kolla)
{{ include_header }}
{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['centos', 'oraclelinux'] %} {% if base_distro in ['centos', 'oraclelinux'] %}
......
...@@ -173,6 +173,10 @@ def argParser(): ...@@ -173,6 +173,10 @@ def argParser():
parser.add_argument('-d', '--debug', parser.add_argument('-d', '--debug',
help='Turn on debugging log level', help='Turn on debugging log level',
action='store_true') action='store_true')
parser.add_argument('-i', '--include-header',
help=('Path to custom file to be added at '
'beginning of base Dockerfile'),
type=str)
return vars(parser.parse_args()) return vars(parser.parse_args())
...@@ -191,6 +195,7 @@ class KollaWorker(object): ...@@ -191,6 +195,7 @@ class KollaWorker(object):
self.prefix = self.base + '-' + self.type_ + '-' self.prefix = self.base + '-' + self.type_ + '-'
self.config = ConfigParser.SafeConfigParser() self.config = ConfigParser.SafeConfigParser()
self.config.read(os.path.join(sys.path[0], '..', 'build.ini')) self.config.read(os.path.join(sys.path[0], '..', 'build.ini'))
self.include_header = args['include_header']
self.image_statuses_bad = {} self.image_statuses_bad = {}
self.image_statuses_good = {} self.image_statuses_good = {}
...@@ -225,6 +230,9 @@ class KollaWorker(object): ...@@ -225,6 +230,9 @@ class KollaWorker(object):
'install_type': self.type_, 'install_type': self.type_,
'namespace': self.namespace, 'namespace': self.namespace,
'tag': self.tag} 'tag': self.tag}
if self.include_header:
with open(self.include_header, 'r') as f:
values['include_header'] = f.read()
content = template.render(values) content = template.render(values)
with open(os.path.join(path, 'Dockerfile'), 'w') as f: with open(os.path.join(path, 'Dockerfile'), 'w') as f:
f.write(content) f.write(content)
......
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