Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build args to be overridden from the command line #151

Open
outofcoffee opened this issue Aug 7, 2018 · 2 comments
Open

Allow build args to be overridden from the command line #151

outofcoffee opened this issue Aug 7, 2018 · 2 comments

Comments

@outofcoffee
Copy link

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.

@dnephin
Copy link
Owner

dnephin commented Aug 8, 2018

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.

@outofcoffee
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants