dnephin/dobi

Allow build args to be overridden from the command line

outofcoffee opened this issue · 2 comments

In addition to the static set of args within the dobi file, it would be helpful to allow build args to be overridden from the command line.

One of the scenarios this would support is where a build arg is used within a Dockerfile but is known only at runtime. For example, an arg might form part of the base image name/tag from which the image extends.

Setting anything on the command line is difficult. dobi was designed so that any parameters are encoded in the config. make works in a similar way. The only way to specify parameters is through environment variables. #91 seems related, I don't have a good solution for that.

There are a couple ways to set dynamic values from the config. By setting an env variable on the command like you can read it using {env.VARIABLENAME} (http://dnephin.github.io/dobi/variables.html).

If the value is only available as output from some command than you can use job:capture (http://dnephin.github.io/dobi/tasks.html#job-tasks) to run the command and capture stdout to a variable, which you can then use with the same {env.VARNAME} syntax.

Thanks @dnephin; I'd missed the capture task. That might do the job, cheers!