amazon-ecr-login icon indicating copy to clipboard operation
amazon-ecr-login copied to clipboard

Compatibility with `docker/build-push-action`

Open gsuess opened this issue 1 year ago • 1 comments

Is aws-actions/amazon-ecr-login compatible with docker/build-push-action?

This should be documented in the readme. I am wondering if I can just have this:

- name: AWS Assume Role
  uses: aws-actions/configure-aws-credentials@v2
  with:
    role-to-assume: ${{ vars.AWS_OIDC_ACCESS_ROLE }}
    aws-region: eu-central-1

- name: Log in to the Container registry
  id: ecr-login
  uses: aws-actions/amazon-ecr-login@v1

- name: Docker meta
  id: meta
  uses: docker/metadata-action@v4
  with:
    images: ${{ steps.ecr-login.outputs.registry }}/${{ env.IMAGE_NAME }}

- name: Set up Docker Build
  uses: docker/setup-buildx-action@v2

- name: Build and push
   id: push
   uses: docker/build-push-action@v4
   with:
     push: true
     tags: ${{ steps.meta.outputs.tags }}
     labels: ${{ steps.meta.outputs.labels }}

I will go ahead and test it and report back here, but either I think it should documented or if its not compatible, perhaps it can be made compatible?

It would make transitioning container registry to ECR easier as less changes would be needed for existing workflows.

It would also allow reusability of workflows so that they deploy to multiple registries.

gsuess avatar Aug 01 '23 17:08 gsuess

Okay turns out that the above works fine so the two actions are compatible with each other.

I believe this is a better approach the one currently documented on the Readme.md.

gsuess avatar Aug 02 '23 12:08 gsuess