docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.24k stars 541 forks source link

secret-files doesn't mount the secret properly #891

Closed erez-levi closed 1 year ago

erez-levi commented 1 year ago

**** UPDATE

was issue on my side

Behaviour

Steps to reproduce this issue

  1. set up a workflow like this:

    - name: build image
    uses: docker/build-push-action@v4
    with:
      push: true
      context: ./${{ inputs.image_path }}
      tags: |
       ${{ inputs.docker_repo }}:latest
       ${{ inputs.docker_repo }}:${{ env.TAG }}
      build-args: |
        GIT_BRANCH=${{ inputs.branch }}
        GIT_REPO=${{ github.repository }}
        GIT_TAG=${{ env.TAG }}
      file: ./${{ inputs.image_path }}/${{ inputs.dockerfile_name }}
      secret-files: |
        "pip-conf=/home/runner/.pip/pip.conf"
        "netrc=/home/runner/.netrc"
  2. have the following in the Dockerfile: RUN --mount=type=secret,id=netrc,dst=/root/.netrc \ pip install --no-cache-dir --upgrade -r /requirements.txt

  3. run the workflow

Expected behaviour

It should mount the secrets properly using the secret-files I provided

Actual behaviour

the authentication doesn't work, I'm seeing the following in the logs: --secret id=PIP-CONF,src=/tmp/docker-actions-toolkit-NObXci/tmp-636-icp1lfMIcwqZ --secret id=NETRC,src=/tmp/docker-actions-toolkit-NObXci/tmp-636-GR61GDx1UEq5

Not sure if it's suppose to be like this

Configuration

I'm creating the /home/runner/.netrc and /home/runner/.pip/pip.conf in a step before.

more information:

currently I'm using the "docker buildx build" builder with specifying the secrets like this: --secret id=pip-conf,src=$HOME/.pip/pip.conf --secret id=netrc,src=$HOME/.netrc

when I'm running the action like the following I get error for files not found: secret-files: | "pip-conf=$HOME/.pip/pip.conf" "netrc=$HOME.netrc"

please let me know if it's something in my configuration