Skip to content

dinushchathurya/push-docker-image-to-aws-elastic-container-registry-using-github-action

Repository files navigation

Publish Docker Image to AWS Elastic Container Registry

In here, the following workflow can use to publish the docker image to AWS Elastic Container Registry(ECR) using GitHub Action. This GitHub action will be triggered every time a new Git tag is pushed to the GitHub repository.

Create Environment Variables

1.Create AWS ACCESS KEY & AWS SECRET ACCESS KEY in your AWS account.

2.Go to your GitHub repositorie's Settings => Secrets => Actions and create two New Repsitory Secret. Name it AWS_ACCESS_KEY_ID and set the value to your created AWS ACCESS KEY & AWS_SECRET_ACCESS_KEY and set the value to your created AWS SECRET ACCESS KEY.

Publish new Docker Image with version number

As usual, stage your changes and then commit them. Then, run the folowing commands:

git tag <your_tag> 

Then run the following command to push changes to GitHub repository:

git push origin <tag_name>

The following workflow is designed to be triggered when a new Git tag is pushed project repository. Using the workflow, you can perform pushes to the repository (git push) without triggering this workflow. For example, when updating the project’s README file, you can run the following command:

git push <branch_name>