DockerMake icon indicating copy to clipboard operation
DockerMake copied to clipboard

Template pre-processing of the makefile

Open epcim opened this issue 7 years ago • 2 comments

If I am aware there is not better Makefile/build a framework to compose images as in this tool. I have some suggestions/enhancements:

Add "Jinja2" processing of the makefile before yaml is parsed, to allow things like: % for os_codename in [xenial, bionic] debian-{{os_codename}: FROM: debian:{{os_codename}} % endfor

epcim avatar Feb 08 '18 08:02 epcim

Thanks for your comments and issues, @epcim! I agree that would definitely be great to have methods for additional parameterization within the docker-makefile.

For my personal use cases, docker build-args have gone a long way towards addressing this need. Jinja is a little out of scope for my conception of this tool - if I personally needed this functionality, I'd likely just use a separate Jinja CLI tool to generate DockerMake.yml, rather than building templating into docker-make.

avirshup avatar Feb 22 '18 00:02 avirshup

I think so finally, jinja2 is out of scope. For anything other, I found pyInvoke (python kind of Makefile) can do the remaining magic quite well. https://github.com/epcim/docker-salt-formulas/blob/master/tasks.py

What I would like to see anyway is "args" to tasks names and have them available in FROM. Simply as python Template formatting stuff, not the jinja. I know it may pain for "keys" but it's doable.

# --build-arg os_codename=stretch

debian-${os_codename}:
  FROM: debian:${os_codename}

epcim avatar Feb 22 '18 10:02 epcim