Add support for --build-arg
in Docker-based Action
#2019
Unanswered
nmontmarquette
asked this question in
Ideas
Replies: 2 comments 1 reply
-
Hi @nmontmarquette, I've run into this same issue when using the docker action, and ended up just using the steps:
- run: echo "${{ secrets.BOT_PAT }}" | docker login ghcr.io -u ${{ env.BOT_USERNAME }} --password-stdin
- run: docker build --file ./action-pipenv/Dockerfile --tag ghcr.io/org/name:version --build-arg DOCKER_PYTHON_VERSION=${{ inputs.pipenv-python-version }} ./action-pipenv
- run: docker push ghcr.io/org/name:version Hopefully this helps 😄 |
Beta Was this translation helpful? Give feedback.
1 reply
-
This is a totally different use case, but it is one that could benefit from this same change: gruntwork-io/terragrunt-action#74 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have what I believe to be a minor issue that's forcing me into a disproportional detour.
I want to be able to specify the Docker base image based on a workflow user input. The idea being to save a bit of runtime starting with know Python-good image and not having to start any lower and install a specific Python on top of a lower level, more generic image.
Normally, I'd simply have a
Dockerfile
that uses anARG
statement and then I'd use thedocker build
command with the--build-arg
parameter. The Docker build would then create a varying image based on the supplied parameter or simply use3.9
as default if none was supplied.docker build --file ./action-pipenv/Dockerfile --build-arg DOCKER_PYTHON_VERSION=${PIPENV_PYTHON_VERSION} ./action-pipenv
The current Docker Action is unfortunately not supporting either:
a) The
docker build
--build-arg
parameterb) An indirect value for the Docker Action
image
field. I haven't looked thoroughly through the runner code yet, but from experimentation it looks like only a static value is allowed. I can use a variable in theargs
sub-field, but I cannot use a variable in theimage
field. Note, theargs
field is meant to be used indocker run
not indocker build
.Because the
docker
route is a dead-end for me, I'd have to gocomposite
route duplicating most everything the Docker action does for what I believe is a minor issue :-( Alternatively, not as elegant, the ability to have a dynamicimage
field could be of some help.Any suggestion?
Beta Was this translation helpful? Give feedback.
All reactions