examples
examples copied to clipboard
feat(docker): add Dockerfile.11_final_v2 with hardened, reproducible …
Hi, I'm watching more videos and having more fun. I've added a version that is closer to my prod version.
This commit introduces Dockerfile.11_final_v2, a fully optimized, secure, and deterministic multi‑stage build for the FastAPI service.
Key improvements and changes:
- Uses pinned digest base images (python:bookworm@sha256 and slim@sha256) for deterministic, reproducible builds.
- Introduces Tini as PID 1 for proper signal forwarding and process reaping.
- Builds dependencies via Astral UV for faster, locked, and cached installs.
- Enforces non‑root numeric user (UID/GID 10000) for runtime safety.
- Moves all DB and secret configuration to runtime environment variables instead of build‑time arguments.
- Integrates a lightweight
docker-entrypoint.shfor dynamic env expansion and clean signal handling. - Sets strict runtime hardening: --read-only, --tmpfs /tmp, --cap-drop=ALL, --security-opt no-new-privileges:true.
- Adds OCI metadata labels (build date, revision, description) for traceability.
- Supports reproducible dependency manifest (
dependencies.txt) for auditability. - Enables healthcheck route compatibility with configurable APP_PORT.