Build and Push the docker image on AWS ECR using GitHub actions.
Hello everyone š,
I am Himanshu Singh. I am an Engineer and recently after working as a frontend engineer for more than 2 years, I started doing full-stack. And, my first task was to write a GitHub action to build and push the docker image on AWS ECR.
While working on it, I went through a good number of blogs, and also used ChatGPT, and finally raised a PR.
In this blog, I wanted to write exactly what I did and how you can also write a GitHub action to achieve the same.
Letās begin!
Introduction
As we know, to write a GitHub action, we create a .github/
folder in our codebase and a workflows/
folder in it, containing all our .yaml
files, in which we write the actual steps that an action has to take.
So, first, you can do the same.
I had created
ecr-docker-image.yaml
file in theworkflows/
folder.
Action Steps
Now, letās begin to write the .yaml
file.
We can start by giving a name to our GitHub action.
You can copy the following snippet
name: š³ Build and Push Docker Image to ECR