This project demonstrates a simple Python Flask application containerized using Docker. The application calculates the user's age based on their Date of Birth (DOB). The project incorporates CI/CD to automate building and pushing the Docker image to Docker Hub.
- Flask Web Application: A web application that calculates age from the provided Date of Birth.
- Dockerized Deployment: The application is containerized for seamless deployment across environments.
- Makefile Automation: Simplifies Docker commands for building, running, and pushing the container.
- CI/CD Integration: Automates the Docker build and push process using GitHub Actions.
├── .github/
│ └── workflows/
│ └── cicd.yml
├── .coverage
├── .gitignore
├── app.py
├── Dockerfile
├── Makefile
├── README.md
├── requirements.txt
- Clone the Repository
git clone https://github.com/nogibjj/Mobasserul_Haque_MiniProject12.git
cd Mobasserul_Haque_MiniProject12
- Build the Docker Image
Build the Docker image using the Makefile:
make build
- Run the Docker Container
make run
Access the application in your browser at http://localhost:5000.
- Push the Docker Image to Docker Hub
Authenticate with Docker Hub and push the image:
make push
-
Home Page (
/
): Displays a form for users to enter their Date of Birth. -
Calculate Age (
/calculate_age
): Processes the DOB input and calculates the user's age.
This project uses GitHub Actions to automate Docker image builds and deployments. The workflow (.github/workflows/cicd.yml
) performs the following steps:
- Checks out the repository
- Logs into Docker Hub using repository secrets
- Builds the Docker image
- Pushes the image to Docker Hub
- Log in to Docker Hub:
docker login -u ${DOCKER_ID_USER}
- Tag the Docker Image:
docker tag dockerized_app <your-dockerhub-username>/dockerized_app:latest
- Push the Image:
docker push mobasserulhaque/mh_de_week12:tagname
- Pull the Image:
docker pull mobasserulhaque/mh_de_week12:latest
Alternatively, use the following command to simplify the process:
make push
- Docker Image: dockerized_app_image_Link
- Tag:
latest