A production-ready DevOps project using Docker, Flask, and GitHub Actions.
- Flask web application with health checks
- Multi-stage Docker builds for optimization
- Continuous Integration/Continuous Deployment with GitHub Actions
- Unit testing with pytest
- Environment configuration management
- Docker health checks
- Production-ready with Gunicorn
- Docker
- Docker Compose
- Python 3.9+
- Git
- Clone the repository:
git clone <your-repo-url>
cd <repo-name>
- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
- Run tests:
python -m pytest tests/
- Run the application locally:
python app.py
- Build and start the container:
docker-compose up --build
- Access the application:
- Main application: http://localhost:5000
- Health check: http://localhost:5000/health
The project includes a GitHub Actions workflow that:
- Runs unit tests
- Builds the Docker image
- Tests the Docker container
- (Optional) Deploys to Docker Hub or your preferred cloud provider
For production deployment:
- Set appropriate environment variables
- Use the multi-stage Docker build
- Enable health checks
- Configure your cloud provider's deployment settings
- Health check endpoint:
/health
- Docker health check is configured in the Dockerfile
- Container logs available via
docker-compose logs
docker-compose down