CI/CD Deploy

Overview
This project builds a production-ready CI/CD pipeline that automatically installs dependencies, runs tests, builds the application, creates a Docker image, pushes it to a registry, and deploys it to a cloud server.
The focus is on end-to-end automation with real deployment, not just local builds.
Stack
GitHub Actions
Docker
Amazon EC2
Amazon ECR
Node.js application
Pipeline Flow
Code → Git Push → CI Pipeline → Build → Docker Image → Push ECR → Deploy EC2Dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]CI/CD Workflow
name: CI/CD Pipeline
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
- name: Build App
run: npm run build
- name: Login to AWS ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Build Docker Image
run: docker build -t app .
- name: Tag Image
run: docker tag app:latest <ECR_REPO_URL>:latest
- name: Push to ECR
run: docker push <ECR_REPO_URL>:latest
- name: Deploy to EC2
run: |
ssh ubuntu@<EC2_IP> "
docker pull <ECR_REPO_URL>:latest &&
docker stop app || true &&
docker rm app || true &&
docker run -d -p 80:3000 --name app <ECR_REPO_URL>:latest
"Server Setup (EC2)
sudo apt update
sudo apt install docker.io -y
sudo systemctl start dockerResult
Fully automated deployment on every push
Docker image stored in ECR
Live application updated on EC2
No manual deployment steps
Key Points
Uses real cloud deployment (not local only)
Image-based deployment ensures consistency
Pipeline enforces build → test → deploy flow
Final Note
This setup demonstrates a complete DevOps workflow—from code commit to live deployment.
Every release follows the same automated path, making the system predictable, stable, and production-ready.

