Add custom footer section to final image Dockefiles

This patch allows to add instructions to final images
like setting runtime environment variables or deleting
build time HTTP proxies

Change-Id: I23ad325e0898d77804a22038ddc618e1e49afd88
Partially-Implements: blueprint add-proxy-to-dockerfiles
This commit is contained in:
Vladislav Belogrudov 2015-08-28 13:17:41 +03:00
parent 55e6e1f8d2
commit 630f437576
64 changed files with 134 additions and 0 deletions

View File

@ -14,3 +14,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -16,3 +16,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY ./start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -2,3 +2,5 @@ FROM {{ base_distro }}:{{ base_distro_tag }}
MAINTAINER Kolla Project (https://launchpad.net/kolla)
CMD /bin/sleep infinity
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -17,3 +17,5 @@ COPY start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -16,3 +16,5 @@ COPY start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -46,3 +46,5 @@ COPY config-external.sh /opt/kolla/
COPY start.sh /
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -17,3 +17,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -23,3 +23,5 @@ COPY start.sh /
COPY config-external.sh ensure_latest_config.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -21,3 +21,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -21,3 +21,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -24,3 +24,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -54,3 +54,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -22,3 +22,5 @@ COPY start.sh check_alive.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -67,3 +67,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -34,3 +34,5 @@ RUN mkdir -p /etc/ansible /usr/share/ansible \
&& echo 'localhost ansible_connection=local' > /etc/ansible/hosts
COPY kolla_keystone_service.py kolla_keystone_user.py /usr/share/ansible/
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -19,3 +19,5 @@ COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -17,3 +17,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -21,3 +21,5 @@ VOLUME /data/db
VOLUME /var/log/mongodb
ENTRYPOINT exec /bin/mongod --dbpath /data/db --logpath /var/log/mongodb/mongo.log --noprealloc --smallfiles
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY config-external.sh /opt/kolla/
COPY start.sh /
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY config-external.sh /opt/kolla/
COPY start.sh /
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -31,3 +31,5 @@ COPY neutron-l3-agent/ /opt/kolla/neutron-l3-agent
COPY neutron-metadata-agent/ /opt/kolla/neutron-metadata-agent
CMD ["/usr/bin/supervisord"]
{{ include_footer }}

View File

@ -24,3 +24,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -28,3 +28,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -27,3 +27,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -30,3 +30,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -28,3 +28,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -24,3 +24,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -30,3 +30,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -14,3 +14,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY ovs_ensure_configured.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -23,3 +23,5 @@ COPY start.sh /
COPY config-rabbit.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -15,3 +15,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -16,3 +16,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -5,3 +5,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -12,3 +12,5 @@ RUN yum -y install openstack-swift-proxy && yum clean all
COPY ./start.sh /start.sh
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -28,3 +28,5 @@ COPY start.sh /
COPY config-external.sh /opt/kolla/
CMD ["/start.sh"]
{{ include_footer }}

View File

@ -249,6 +249,10 @@ def arg_parser():
help=('Path to custom file to be added at '
'beginning of base Dockerfile'),
type=str)
parser.add_argument('-I', '--include-footer',
help=('Path to custom file to be added at '
'end of Dockerfiles for final images'),
type=str)
return vars(parser.parse_args())
@ -281,6 +285,7 @@ class KollaWorker(object):
self.config = ConfigParser.SafeConfigParser()
self.config.read(os.path.join(self.base_dir, 'build.ini'))
self.include_header = args['include_header']
self.include_footer = args['include_footer']
self.regex = args['regex']
self.image_statuses_bad = dict()
@ -320,6 +325,9 @@ class KollaWorker(object):
if self.include_header:
with open(self.include_header, 'r') as f:
values['include_header'] = f.read()
if self.include_footer:
with open(self.include_footer, 'r') as f:
values['include_footer'] = f.read()
content = template.render(values)
with open(os.path.join(path, 'Dockerfile'), 'w') as f:
f.write(content)