This project demonstrates the lifecycle of an open-source application, from raw Python code to a publicly available container image via a standardized CI/CD pipeline.
When code is merged into the main branch, a GitHub Actions workflow is triggered to:
- Execute a test suite.
- Build the application into a Docker image (only if tests pass).
- Publish that image to the GitHub Container Registry (GHCR).
The demo app is a random value generator built with FastAPI. Once running, you can
see the API documentation in your browser at /docs.
- Install dependencies:
pip install -r requirements.txt - Run locally:
fastapi dev - Run tests:
pytest
- Build an image:
docker build -t random-value-generator . - Run a container:
docker run --name generator -p 8000:8000 random-value-generator - Run tests:
docker exec -it generator bashthenpytest
- Run Tests: Triggers
pytestin a GitHub runner. - Build & Push: On successful tests, an image is built and pushed to the GitHub Container Registry.
GET /: Basic info.POST /random-number: Returns a random int betweenbottomandtop.POST /coin-flip: Returns Heads or Tails.POST /dice-roll: Returns a list of results based onnumber_of_dice.