build-args non-functional for delivering more than one k/v set
See original GitHub issueTroubleshooting
This is… odd that this has to be brought up with… well, you folks, but here goes…
Currently build-push-action@v2
key, build-args requires a string. Regardless of what getInputList()
actually does, --build-arg
does not configure more than a single key. This is a known… non-issue that is addressable with multiple iterations of --build-arg
on the command line.
See set-build-time-variables docs
Behaviour
Steps to reproduce this issue
- with a job step of
-
name: Build the Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: gladiatr72/python:${{ env.PYTHON_VERSION }}
build-args: PYTHON_VERSION=${{ env.PYTHON_VERSION}}\nBUILD_ARGS='--enable optimizations --with-lto'
or
-
name: Build the Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: gladiatr72/python:${{ env.PYTHON_VERSION }}
build-args: |
PYTHON_VERSION=${{ env.PYTHON_VERSION}}
BUILD_ARGS='--enable optimizations --with-lto'
The above syntax does not work… was an attempt to follow the expectations of that field from the tests.
Expected behaviour
The action should correctly parse the build-arg string into an appropriate docker CLI invocation.
--build-arg KEYA=VALA --build-arg KEYB=KEYB
Actual behaviour
The Docker documentation and the Internet insists trying to pass multiple arguments with a single
--build-arg
does not work and will never work. As claimed by the aforementioned entities, multiple key/val sets must be injected with the same number of--build-arg
flags. Whatever I’ve tried to append to the initialbuild-args
value becomes part of the initial var’s argument and predictably breaks where those vars are intended for substitutions within the Dockerfile.
Configuration
- Repository URL (if public): gladiatr72/actions-test
- Build URL (if public): https://github.com/gladiatr72/actions-test/actions/runs/611841318
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
if-you-build-it:
env:
PYTHON_VERSION: "3.6.13"
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v2
-
name: setup buildx
uses: docker/setup-buildx-action@v1
-
name: login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build the Docker image
uses: docker/build-push-action@v2
with:
push: true
tags: gladiatr72/python:${{ env.PYTHON_VERSION }}
build-args: PYTHON_VERSION=${{ env.PYTHON_VERSION}}\nBUILD_ARGS='--enable optimizations --with-lto'
Logs
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@gladiatr72 Explained here: https://github.com/docker/build-push-action#inputs
@ilyamochalov
There is no such env var called
BUILD_ARGS
for buildx but--build-arg
flag which is handled in this action by thebuild-args
input translated like this.