Python Demo - Pizza Session (18 Nov)
This repository demonstrates a Python-based application designed for the Pizza session, showcasing various services built with Docker, Python, and Makefiles.
This project consists of a modular setup, with multiple services that serve as independent microservices. These services include:
- API: Provides core API functionalities.
- HR Assistant: A service to assist with HR-related tasks.
- PDF Generator: A tool for generating PDFs based on user inputs.
- Song Generator: A service for generating songs using AI.
- Telegram Bot: A bot integrated with Telegram to perform various operations.
Each service has its own Dockerfile, main.py, and requirements.txt for isolation and scalability.
-
Create and activate a virtual environment:
python3 -m venv .venv . .venv/bin/activateTo confirm the virtual environment is activated, run:
which python
-
Copy the sample environment variables file and customize it:
cp .env.sample .env
Edit the
.envfile to set your custom environment variables.
make install-
Build the containers:
make compose-build
-
Run the containers:
make compose-up
-
View logs:
make compose-logs
-
Stop and clean up the containers:
make compose-down
-
Destroy the containers and volumes:
make compose-destroy
-
Restart the containers:
make compose-restart
Run the Ollama with Gemma2:2b in terminal.
make run-in-terminalThis repository uses a Makefile to simplify development workflows:
install: Installs the required dependencies fromdev-requirements.txt.compose-build: Builds the Docker containers.compose-up: Starts the containers in detached mode, removing orphan containers.compose-down: Stops and removes the containers.compose-destroy: Stops the containers and removes associated volumes.compose-restart: Restarts the running containers.compose-logs: Displays live logs from the running containers.rebuild: Combinescompose-down,compose-build, andcompose-upsteps for rebuilding the containers from scratch.run-in-terminal: Runs the Ollama service with Gemma2:2b interactively.
.github/workflows/
docker-publish.yml # GitHub Actions workflow for Docker publishing
api/
Dockerfile # Dockerfile for the API service
main.py # Main entry point for the API
requirements.txt # Dependencies for the API
services/
hr_assistant/
pdf_generator/
song_generator/
telegram_bot/
.env.sample # Sample environment variables file
.gitignore # Git ignore rules
dev-requirements.txt # Development dependencies
docker-compose.yml # Docker Compose configuration
docker-compose-prod.yml # Production Docker Compose configuration
Makefile # Simplified commands for project management
README.md # Project documentation
This project is distributed under the MIT License.
Feel free to fork this repository and submit pull requests to improve the project!