Build and Push the docker image on AWS ECR using GitHub actions.

Himanshu Singh
4 min readAug 24, 2024

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 the workflows/ 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

--

--

Himanshu Singh
Himanshu Singh

Written by Himanshu Singh

I write blogs around React JS, JavaScript, Web Dev, and Programming. Follow to read blogs around them.

No responses yet