Baboolsoft Services

DevOps Automation with GitHub Actions and Docker

Home / Case Study / DevOps Automation with GitHub Actions and Docker
DevOps Automation with GitHub Actions and Docker

Background

A fintech startup needed to streamline their manual deployment pipeline and improve release frequency without compromising quality. Their core product stack included:

  • Frontend: React (Next.js)
  • Backend: Node.js (NestJS)
  • Database: PostgreSQL (hosted on AWS RDS)

Objective

  • Replace manual FTP deployments with CI/CD
  • Introduce environment-based builds (dev, staging, prod)
  • Enable rollback functionality in case of deployment failure

Tools Used

  • ⚙️ GitHub Actions (CI/CD workflows)
  • 🐳 Docker & Docker Compose
  • ☁️ AWS EC2 & S3
  • 🔐 AWS Secrets Manager

Pipeline Architecture

  1. CI Phase:
    • Run tests (Jest + ESLint)
    • Build Docker image tagged by branch and SHA
  2. CD Phase:
    • Push to AWS ECR
    • Deploy on EC2 with SSH trigger

Sample GitHub Actions Snippet

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Build Docker Image
        run: docker build -t app:GITHUB_SHA .

      - name: Push to AWS ECR
        run: docker push :GITHUB_SHA
      - name: Deploy to EC2
        uses: appleboy/ssh-action@v0.1.5
        with:
          host:  secrets.EC2_HOST 
          username: ec2-user
          key:secrets.EC2_SSH_KEY 
          script: |
            docker pull :
            docker stop app || true
            docker rm app || true
            docker run -d --name app -p 80:3000 :GITHUB_SHA

Challenges

  • Managing secrets across multiple environments
  • Handling rollbacks and failed builds gracefully
  • Ensuring Docker images didn't bloat over time

Optimizations

  • Used multi-stage Docker builds to reduce image size by 60%
  • Added Slack notifications for build status via webhooks
  • Integrated Git tags to trigger production releases only

Results

Metric Before After Improvement
Deployment Time 45 mins 3.5 mins 92%
Release Frequency 1/month 3/week 12x
Rollback Time 1 day 30 sec ~99%

Conclusion

This transformation allowed the team to ship features faster, ensure higher quality builds, and minimize production downtime. Their entire release pipeline now runs with zero manual intervention.

Next Steps

  • Set up blue-green deployments with load balancer switching
  • Add SonarQube for code quality reports
  • Extend CI pipeline to include end-to-end tests with Playwright