containerization-and-deploymentlisted
Install: claude install-skill ajyadav013/claude-kit
# Containerization and Deployment
Docker containerization, multi-role dispatch, secrets handling, and local dev infrastructure patterns from production services.
## When to use
- Containerizing FastAPI/Python backend services
- Implementing one-image-many-roles pattern (server/consumer/worker/cron from same Dockerfile)
- Writing certs/keytabs from environment variables for Kafka SASL_SSL/Kerberos
- Setting up local dev with docker-compose (postgres/redis/kafka/temporal)
- Deploying to Cloud Run, GKE, or other container platforms
- Handling secrets and credentials in containerized environments
- Configuring health checks and readiness probes
## Core conventions
### Multi-Stage Dockerfile Pattern
**Builder + runtime separation**: Use a builder stage to install build dependencies and compile wheels; copy only the virtual environment and application code to a minimal runtime stage.
**Alpine for minimal footprint**: Use `python:3.10-alpine` or `python:3.11-slim` base images; install only runtime dependencies in the final stage. Alpine offers minimal footprint; slim provides broader compatibility.
**Dependency caching**: Copy `requirements.txt` before application code; leverage Docker layer caching to avoid reinstalling dependencies on every code change.
**Security hardening**: Remove `.git` directory after capturing commit SHA; use `--no-cache-dir` with pip; set `PYTHONUNBUFFERED=1` for immediate log output.
### Entrypoint MODE Dispatch
**Single entrypoint, multiple rol