question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build-args non-functional for delivering more than one k/v set

See original GitHub issue

Troubleshooting

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

  1. 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 initial build-args value becomes part of the initial var’s argument and predictably breaks where those vars are intended for substitutions within the Dockerfile.

Configuration

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

5_Build the Docker image.txt

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
crazy-maxcommented, Mar 1, 2021

@gladiatr72 Explained here: https://github.com/docker/build-push-action#inputs

        -
          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
2reactions
crazy-maxcommented, Mar 8, 2021

@ilyamochalov

not able to find any docs on BUILD_ARGS env var mentioning neither in BuildX

There is no such env var called BUILD_ARGS for buildx but --build-arg flag which is handled in this action by the build-args input translated like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker build with --build-arg with multiple arguments
This doesn't answer the question of how to set multiple build args. With buildkit you won't see separate steps being performed, and with...
Read more >
Quarkus - All configuration options
AWS Lambda Type Default Agroal ‑ Database connection pool Type Default quarkus.datasource.jdbc.url. The datasource URL string Additional named datasources Type Default
Read more >
Docker Engine release notes
Fix printing multiple messages on a single line. Fixes broken output during builds. Follow symlinks inside container's root for ADD build ...
Read more >
oci-utils bug fix update - Oracle Linux Yum Server
json (#17275) - Remove the deprecated /container/ps endpoint from the API ... to dynamically connect containers to multiple networks (#16645) - Support for ......
Read more >
sbcl/uiop.lisp at master · sbcl/sbcl - GitHub
(set-setf-function-symbol new-setf-symbol symbol kind)))). #+(or clisp clozure). (multiple-value-bind (overwritten-setf foundp).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found