A fully containerized Python Flask application with an automated CI/CD pipeline using GitHub Actions and Docker. This project demonstrates a real-world DevOps workflow — from code commit to automated build and deployment.
┌─────────────────────────────────────────────────────────────────────┐
│ CI/CD PIPELINE │
│ │
│ 👨💻 Developer │
│ │ │
│ │ git push │
│ ▼ │
│ ┌──────────────┐ trigger ┌────────────────────────────┐ │
│ │ GitHub │ ──────────────► │ GitHub Actions Workflow │ │
│ │ Repository │ │ │ │
│ └──────────────┘ │ 1️⃣ Checkout Code │ │
│ │ 2️⃣ Set up Python │ │
│ │ 3️⃣ Install Dependencies │ │
│ │ 4️⃣ Run Tests │ │
│ │ 5️⃣ Build Docker Image │ │
│ │ 6️⃣ Push to Registry │ │
│ └────────────┬───────────────┘ │
│ │ │
│ │ docker push │
│ ▼ │
│ ┌────────────────────┐ │
│ │ Docker Registry │ │
│ │ (Docker Hub / │ │
│ │ GitHub GHCR) │ │
│ └────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ APPLICATION STACK │
│ │
│ 🐳 Docker Container │
│ ┌──────────────────────────────────────────────┐ │
│ │ │ │
│ │ 🐍 Python Flask App (port 5000) │ │
│ │ ┌──────────────────────────────────┐ │ │
│ │ │ app.py │ │ │
│ │ │ GET / → "Hello from DevOps!" │ │ │
│ │ └──────────────────────────────────┘ │ │
│ │ │ │
│ │ Base Image: python:3.x-slim │ │
│ │ Exposes: port 5000 │ │
│ └──────────────────────────────────────────────┘ │
│ │ │
│ │ HTTP Request │
│ ▼ │
│ 🖥️ Client (curl / Browser) │
│ → http://localhost:5000 │
└─────────────────────────────────────────────────────────────────────┘
devops-ci-cd-project/
├── .github/
│ └── workflows/
│ └── ci.yml # GitHub Actions CI/CD pipeline
├── app.py # Flask application entry point
├── Dockerfile # Container image definition
└── requirements.txt # Python dependencies
| Layer | Technology | Purpose |
|---|---|---|
| Application | Python + Flask | REST API / Web server |
| Containerization | Docker | Package and run the app |
| CI/CD | GitHub Actions | Automate build, test, deploy |
| Runtime | Gunicorn / Flask dev | Serve the application |
# Clone the repository
git clone https://github.com/Aijazkhan123/devops-ci-cd-project.git
cd devops-ci-cd-project
# Build the Docker image
docker build -t devops-ci-cd-project .
# Run the container
docker run -p 5000:5000 devops-ci-cd-projectVisit: http://localhost:5000
# Install dependencies
pip install -r requirements.txt
# Start the Flask app
python app.pyThe GitHub Actions workflow (.github/workflows/ci.yml) triggers on every push to master and:
- Checks out the repository code
- Sets up Python environment
- Installs dependencies from
requirements.txt - Runs tests (if present)
- Builds the Docker image
- Pushes the image to a container registry
- Building and containerizing a Python Flask application with Docker
- Writing a complete CI/CD pipeline with GitHub Actions
- Understanding the full developer workflow: code → commit → build → deploy
- Managing dependencies with
requirements.txtand Docker layers
- Add unit tests with
pytest - Deploy to AWS EC2 / ECS or a Kubernetes cluster
- Add environment-specific config (dev / staging / prod)
- Add health check endpoint (
/health) - Integrate code quality linting (flake8, black)
MIT License — feel free to fork and build on this!
Python · Flask · Docker · GitHub Actions · CI/CD · DevOps