Flask + Docker workshop: build and containerize a full web app in 2 intensive days.
Hands-on with Flask routes, templates, forms and database integration.
Containerize services with Docker and compose multi-container setups.
Gain practical experience through ~70% labs deploying to Docker.
How this helps: bootstrap production-ready Python web apps in containers.
Who it’s for: designed for individuals with Python basics moving to web and DevOps.
Includes optional scaling, CI/CD and cloud deployment patterns.
Curriculum
Day 1 – Foundations & project scaffolding
- Flask design choices: WSGI, request/response cycle, Blueprints, Jinja2 vs. API‑only
- Repository layout (src/), config via environment variables, .env handling; secrets basics
- App factory pattern; Blueprints for modularity; CLI with flask CLI
- Templates, static files, WTForms (optional) and CSRF protection
- REST endpoints and OpenAPI (apispec/flasgger) — request validation (pydantic or marshmallow)
- Docker multi‑stage image; Compose for dev (hot reload) vs. prod
- Hands‑on lab: scaffold project, run in Docker, add a minimal page + JSON API
Day 1 – Data layer & auth
- SQLAlchemy ORM & session patterns; models, relationships, migrations with Alembic
- JWT authentication (access/refresh), sessions vs. tokens; password hashing
- CORS and CSRF — when and how; role‑based access (brief)
- Hands‑on lab: add models/migrations, auth endpoints, seed data
Day 2 – Operations, performance & async workloads
- Gunicorn process model; workers/threads; timeouts and keep‑alive; Nginx reverse proxy (optional)
- Caching (Flask‑Caching with Redis); idempotent endpoints and pagination
- Background jobs with Celery + Redis; retries, time limits, result backends
- WebSockets with Flask‑Sock (optional) and server‑sent events (SSE)
- Observability: structured logging, request IDs, basic metrics; health and readiness endpoints
- Hands‑on lab: containerize prod image, add Celery worker/beat, add caching to a slow endpoint
Day 2 – Quality, testing & CI
- pytest fixtures for app, DB and client; factory_boy/Faker for data
- Integration tests in Docker Compose; coverage and parallel runs
- Pre‑commit hooks (ruff/black); type checks (mypy, optional)
- CI outline (GitHub Actions): build, test, push image; .env and secrets handling
- Wrap‑up: deployment options (container registry, ECS/Kubernetes), next steps
Optional modules
Optional – API gateways & auth providers
- OAuth2/OIDC with external providers (Auth0/Keycloak)
- Rate limiting and API keys (Flask‑Limiter)
Course Day Structure
- Part 1: 09:00–10:30
- Break: 10:30–10:45
- Part 2: 10:45–12:15
- Lunch break: 12:15–13:15
- Part 3: 13:15–15:15
- Break: 15:15–15:30
- Part 4: 15:30–17:30