Trim comments to the non-obvious why
Drop narration, history and restated-code comments across the repo, keep short ones for security boundaries, upstream quirks and ordering constraints, and record the convention in CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+2
-26
@@ -1,29 +1,5 @@
|
||||
# =============================================================================
|
||||
# FastAPI side-service image.
|
||||
#
|
||||
# requirements.txt is copied and installed before the app source so the
|
||||
# dependency layer is cached across code changes. --no-cache-dir keeps pip's
|
||||
# download cache out of the image (this one is a plain layer, not a BuildKit
|
||||
# cache mount, because the dependency set is small).
|
||||
#
|
||||
# PYTHONDONTWRITEBYTECODE stops .pyc files being written into the image and the
|
||||
# dev bind mount; PYTHONUNBUFFERED makes logs appear in `docker logs`
|
||||
# immediately instead of sitting in a buffer — both are standard for
|
||||
# containerised Python and the second one matters for debugging.
|
||||
#
|
||||
# ROOT_PATH=/py: Caddy proxies /py/ and STRIPS the prefix, so the app's routes
|
||||
# are written relative to /. --root-path tells FastAPI it is nonetheless
|
||||
# mounted under a prefix, so the OpenAPI schema and Swagger UI emit correct
|
||||
# /py/... URLs. Without it, /py/docs loads but cannot call anything.
|
||||
#
|
||||
# The CMD is a `sh -c` form on purpose: it needs the shell to expand
|
||||
# ${PYTHON_PORT} and ${ROOT_PATH} at runtime, which the exec form cannot do.
|
||||
# Both have defaults here so the image runs standalone; docker compose normally
|
||||
# supplies them.
|
||||
#
|
||||
# EXPOSE 8000 is documentation only — the port is not published; Caddy reaches
|
||||
# it over app-network.
|
||||
# =============================================================================
|
||||
# ROOT_PATH: Caddy strips /py, so --root-path is what makes /py/docs work.
|
||||
# sh -c so ${PYTHON_PORT} and ${ROOT_PATH} expand at runtime.
|
||||
FROM python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
|
||||
Reference in New Issue
Block a user