Docker container action with parametric Dockerfile filename #26212
-
I was playing around with the creation of a docker container action and I’ve noticed that I can’t select a specific Dockerfile (I have a few of them, each one in a different directory, more on this later) using some input variable provided by the user of the Action as shown below:
I get an error here: “image:’${{ inputs.type }}/Dockerfile’”, because at that point (when the docker image is created before it’s launched) “inputs” does not exist. I’m using the [path]/Dockerfile format because it seems to be the only one available, no custom Dockerfile names. From this it seems that input variables can only be passed to args: and not much else, or at least they can’t be used for that specific parameter of the docker action type. Is this correct and will this always stay like this? And, can the name of the dockerfile be made parametric and dependent on some input parameter chosen by the user of the action in some other way? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi @uraimo, Thanks for being here and our apologies for the delay. Currently, it is not possible to specify a value in that The only supported formats are documented here: I’ve taken your suggestion and passed it along to the appropriate teams. Thanks again for reaching out 😀 |
Beta Was this translation helpful? Give feedback.
-
Thanks Andrea, being able to use variables in more places would be great! In this case, I’ve worked around it launching Docker manually with a minimal Javascript action that boots the container with the Dockerfile I want. |
Beta Was this translation helpful? Give feedback.
-
Hi @uraimo , could you elaborate a bit on how you do this? I’m trying to write an action that somehow takes the Docker image in which it has to run, but I’m stuck. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hey @mosteo, you can take a look at this: https://github.com/uraimo/run-on-arch-action/tree/master/src Another thing that you’ll probably need is retrieving some data from inside your docker, remember that , unexpectedly, you will still be able to call things like ’echo ::set-output name=Name::Value‘ like you would inside the standard action container! |
Beta Was this translation helpful? Give feedback.
-
Very cool. This certainly gives me several ideas to try. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Hi @uraimo,
Thanks for being here and our apologies for the delay. Currently, it is not possible to specify a value in that
image
field in the way that you’ve configured.The only supported formats are documented here:
https://help.github.com/en/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions#image
I’ve taken your suggestion and passed it along to the appropriate teams. Thanks again for reaching out 😀