This practical demonstrates the implementation of a complete Continuous Integration and Continuous Deployment (CI/CD) pipeline by integrating application development, containerization, and automated deployment workflows. The project focuses on building a FastAPI-based application, containerizing it using Docker, and automating the build and push process using GitHub Actions.
The pipeline ensures that every change pushed to the repository triggers an automated workflow that builds a Docker image and publishes it to Docker Hub securely.
Developer → Git Push → GitHub Repository → GitHub Actions Workflow → Docker Build → Docker Push → Container Deployment
DevOps-Containerization/ │ ├── .github/ │ └── workflows/ │ └── april10-docker.yml │ └── April_10/ ├── main.py ├── Dockerfile ├── requirements.txt └── README.md
A FastAPI application was developed to provide REST endpoints. The application returns structured JSON responses containing user information including name, SAP ID, and location.
The application supports:
Dependencies were managed using a requirements.txt file, ensuring consistent and reproducible environments across builds.
Dependencies include:
The application was containerized using Docker. A lightweight base image (python:3.10-slim) was used to optimize performance and reduce image size.
docker build -t fastapi-app .
docker run -p 8081:80 fastapi-app
A repository was created on Docker Hub to store container images.
docker tag fastapi-app nitanshutak/fastapi-app:v0.1
docker push nitanshutak/fastapi-app:v0.1
A GitHub Actions workflow was created to automate the process of building and pushing Docker images.
.github/workflows/april10-docker.yml
Authentication with Docker Hub was implemented using GitHub Secrets.
Secret Used:
This ensures that sensitive credentials are not exposed in code.
Upon pushing code:
The deployed image was tested locally by pulling from Docker Hub and running the container.
docker run -p 8082:80 nitanshutak/fastapi-app:v0.1
Application output was successfully accessed through the browser.
This practical demonstrates a complete DevOps lifecycle starting from application development to automated deployment. The integration of Docker and GitHub Actions provides a scalable and efficient workflow for modern software development.
The implementation reflects industry-standard practices for building automated, reliable, and production-ready systems.