mr-smithers-excellent / docker-build-push

Docker Build & Push GitHub Action
MIT License
286 stars 61 forks source link

Add option to use ssh-agent forwarding #144

Closed paretje closed 1 year ago

paretje commented 1 year ago

This exposes the ssh option of docker build, allowing us to load an ssh key into the ssh-agent so it can be used while building the image, e.g. to pull from a private git repository.

An example:

steps:
  - uses: actions/checkout@v3
    name: Check out code

  - uses: webfactory/ssh-agent@v0.7.0
    with:
      ssh-private-key: ${{ secrets.SSH_KEY }}

  - uses: mr-smithers-excellent/docker-build-push@v6
    name: Build & push Docker image
    with:
      image: repo/image
      tags: v1, latest
      registry: registry-url.io
      dockerfile: Dockerfile.ci
      username: ${{ secrets.DOCKER_USERNAME }}
      password: ${{ secrets.DOCKER_PASSWORD }}
      ssh: |
        default=${{ env.SSH_AUTH_SOCK }}
mr-smithers-excellent commented 1 year ago

/ok-to-test

mr-smithers-excellent commented 1 year ago

@paretje - thanks for the contribution. This will be released in v6.2