Welcome to the FastAPI Docker Deployment project! This repository demonstrates how to automate the creation and deployment of a Dockerized FastAPI application using GitHub Actions. Whether youβre a DevOps enthusiast or a developer looking to streamline your CI/CD pipeline, this project is for you!
push event.Before you begin, ensure you have the following installed:
git clone https://github.com/your-username/devops-assignment.git
cd devops-assignment
pip install -r requirements.txt
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
docker build -t your-dockerhub-username/fastapi-app:latest .
docker run -p 8000:8000 your-dockerhub-username/fastapi-app:latest
Open your browser and go to: http://localhost:8000
This project uses GitHub Actions to automate the build and deployment process. Hereβs how it works:
push event to the main branch.Check out the workflow file: .github/workflows/docker-deploy.yml
To push the Docker image to Docker Hub, you need to set up a Personal Access Token:
DOCKERHUB_TOKEN and paste the token value.The Docker image for this project is available on Docker Hub. You can pull it using:
docker pull your-dockerhub-username/fastapi-app:latest
Docker Hub URL: https://hub.docker.com/repository/docker/your-dockerhub-username/fastapi-app
devops-assignment/
βββ .github/
β βββ workflows/
β βββ docker-deploy.yml # GitHub Actions workflow
βββ main.py # FastAPI server code
βββ requirements.txt # Python dependencies
βββ Dockerfile # Docker configuration
βββ README.md # Project documentation
Happy Coding! π