A Flask web application deployed on Microsoft Azure with an automated CI/CD pipeline using GitHub Actions.
This project was developed as part of my CodeAlpha internship to gain practical experience with cloud deployment, continuous integration, continuous deployment, automated testing, and Azure App Service.
The application itself is intentionally simple. It provides a few API endpoints that return application and health information.
The main purpose of this project is to demonstrate how application code can be automatically tested and deployed to the cloud whenever changes are pushed to GitHub.
The deployment pipeline follows this workflow:
Developer pushes code
|
v
GitHub
|
v
GitHub Actions
|
v
Install dependencies
|
v
Run automated tests
|
v
Tests pass?
/ \
No Yes
| |
Stop Azure Login
|
v
Azure App Service
|
v
Application deployed
The deployment job only runs when the tests pass and the change is pushed to the master branch.
- Flask API
- Automated testing with Pytest
- GitHub Actions CI/CD pipeline
- Automatic deployment to Azure App Service
- Gunicorn production WSGI server
- Azure CLI based cloud management
- Secure Azure authentication using GitHub Secrets
- Health check endpoint
- Application version endpoint
Returns the current application status.
Example response:
{
"message": "Azure CI/CD Demo Application",
"status": "running"
}Returns the health status of the application.
Example response:
{
"status": "healthy"
}Returns the current application version.
Example response:
{
"version": "1.0.0"
}The application is deployed on Microsoft Azure App Service.
Base URL:
https://codealpha-azure-cicd-rameen.azurewebsites.net
Example:
https://codealpha-azure-cicd-rameen.azurewebsites.net/health
The GitHub Actions workflow is defined in:
.github/workflows/ci.yml
Whenever code is pushed to the master branch, the workflow performs the following steps:
- Checks out the repository.
- Sets up Python 3.13.
- Installs project dependencies.
- Runs the automated test suite.
- Authenticates with Microsoft Azure.
- Configures the Azure App Service for dependency installation.
- Deploys the application to Azure App Service.
The deployment job depends on the test job, so deployment is blocked if the tests fail.
The project uses Pytest for automated testing.
The current test suite covers:
- Application home endpoint
- Health endpoint
- Version endpoint
Run the tests locally with:
python -m pytestCurrent result:
3 passed
The application is hosted using:
- Azure Resource Group
- Azure App Service Plan
- Azure App Service
- Linux-based Python runtime
- Gunicorn
The Azure resources were created and configured using Azure CLI.
The production application uses Gunicorn with the following startup command:
gunicorn --bind=0.0.0.0:8000 run:app
CodeAlpha_azure_cicd_project/
|
+-- .github/
| +-- workflows/
| +-- ci.yml
|
+-- app/
| +-- __init__.py
|
+-- tests/
| +-- test_app.py
|
+-- .gitignore
+-- requirements.txt
+-- run.py
+-- README.md
- Python 3.13
- Flask
- Pytest
- Gunicorn
- Git
- GitHub
- GitHub Actions
- Microsoft Azure
- Azure App Service
- Azure CLI
git clone https://github.com/rameenali03/CodeAlpha_azure_cicd_project.git
cd CodeAlpha_azure_cicd_projectpython -m venv venvOn Windows PowerShell:
.\venv\Scripts\Activate.ps1pip install -r requirements.txtpython run.pyThe application will be available locally at:
http://127.0.0.1:5000
This project provided hands-on experience with:
- Building a basic Flask application
- Writing automated tests
- Managing dependencies
- Using Git and GitHub
- Creating GitHub Actions workflows
- Managing Azure resources with Azure CLI
- Deploying a Python application to Azure App Service
- Configuring a production WSGI server with Gunicorn
- Using GitHub Secrets for cloud authentication
- Implementing an automated test-before-deploy workflow
The final result is a working cloud deployment where a successful code push can trigger automated testing and deployment to Azure.
Developed as part of the CodeAlpha Internship program.