[openstack-dev] [kolla] prototype of a DSL for generating Dockerfiles

Steven Dake (stdake) stdake at cisco.com
Fri May 27 03:05:06 UTC 2016

Hey folks,

While Swapnil has been busy churning the dockerfile.j2 files to all match the same style, and we also had summit where we declared we would solve the plugin problem, I have decided to begin work on a DSL prototype.

Here are the problems I want to solve in order of importance by this work:

  1.  Build CentOS, Ubuntu, Oracle Linux, Debian, Fedora containers
  2.  Provide a programmatic way to manage Dockerfile construction rather then a manual (with vi or emacs or the like) mechanism
  3.  Allow complete overrides of every facet of Dockerfile construction, most especially repositories per container (rather than in the base container) to permit the use case of dependencies from one version with dependencies in another version of a different service
  4.  Get out of the business of maintaining 100+ dockerfiles but instead maintain one master file which defines the data that needs to be used to construct Dockerfiles
  5.  Permit different types of optimizations or Dockerfile building by changing around the parser implementation - to allow layering of each operation, or alternatively to merge layers as we do today

I don't believe we can proceed with both binary and source plugins given our current implementation of Dockerfiles in any sane way.

I further don't believe it is possible to customize repositories & installed files per container, which I receive increasing requests for offline.

To that end, I've created a very very rough prototype which builds the base container as well as a mariadb container.  The mariadb container builds and I suspect would work.

An example of the DSL usage is here:

A very poorly written parser is here:

I played around with INI as a format, to take advantage of oslo.config and kolla-build.conf, but that didn't work out.  YML is the way to go.

I'd appreciate reviews on the YML implementation especially.

How I see this work progressing is as follows:

  1.  A yml file describing all docker containers for all distros is placed in kolla/docker
  2.  The build tool adds an option -use-yml which uses the YML file
  3.  A parser (such as load.py above) is integrated into build.py to lay down he Dockerfiles
  4.  Wait 4-6 weeks for people to find bugs and complain
  5.  Make the -use-yml the default for 4-6 weeks
  6.  Once we feel confident in the yml implementation, remove all Dockerfile.j2 files
  7.  Remove -use-yml option
  8.  Remove all jinja2-isms from build.py

This is similar to the work that took place to convert from raw Dockerfiles to Dockerfile.j2 files.  We are just reusing that pattern.  Hopefully this will be the last major refactor of the dockerfiles unless someone has some significant complaints about the approach.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160527/45358aa0/attachment.html>

More information about the OpenStack-dev mailing list