for link : https://dasmat13.github.io/python-docker-dev-example/#overview https://docs.docker.com/language/python/develop/
<title>Python Docker Dev Example - Setup Guide</title> <style> body { font-family: Arial, sans-serif; max-width: 960px; margin: auto; padding: 2rem; background-color: #f4f4f4; color: #333; } h1, h2, h3 { color: #2c3e50; } pre { background-color: #2d2d2d; color: #f8f8f2; padding: 1em; border-radius: 6px; position: relative; overflow-x: auto; } code { font-family: monospace; } .copy-button { position: absolute; top: 10px; right: 10px; background: #007bff; color: #fff; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; } .copy-button:hover { background: #0056b3; } </style>This guide helps you get started with cloning, running, and deploying this FastAPI + PostgreSQL project using Docker and Kubernetes.
Copygit clone https://github.com/your-username/python-docker-dev-example.git
cd python-docker-dev-example- Python 3.12+
- Docker & Docker Compose
- kubectl & Kubernetes cluster (e.g. Minikube)
Copydocker compose up --buildCopycurl http://localhost:8001/Copypip install -r requirements.txt
pip install pre-commit pyright
pre-commit install
pre-commit run --all-files
pyrightCopykubectl apply -f docker-postgres-kubernetes.yamlCopykubectl get servicesCopykubectl get nodes -o wideCopycurl http://<INTERNAL-IP>:30001/Copykubectl port-forward service/service-entrypoint 8001:8001
curl http://localhost:8001/- β
curl localhost:30001fails: check pod logs - β
kubectl applyerror: context not set β usekubectl config use-contextor start cluster
.
βββ app.py
βββ config.py
βββ Dockerfile
βββ compose.yaml
βββ docker-postgres-kubernetes.yaml
βββ requirements.txt
βββ .pre-commit-config.yamlMIT
<script> function copyText(button) { const code = button.nextElementSibling.innerText; navigator.clipboard.writeText(code).then(() => { button.innerText = 'Copied!'; setTimeout(() => button.innerText = 'Copy', 2000); }); } </script>