Caddy takes nginx's place in compose: ports 80/443, the fixed address 172.28.255.251 that cloudflared pins the public names to, the network aliases, the healthcheck and the autoheal label. nginx and certbot are removed from compose; Caddy already holds its own certificates in ./caddy/data, obtained while it ran beside nginx. `traffic` now tails logs/caddy/payloads.log, and the dev override switches Caddy to its dev sites instead of putting nginx in DEV_MODE. Docs and comments that described nginx's behaviour now describe Caddy's: CLAUDE.md, DEPLOYMENT.md (topology, boot paths, TLS, rate limits, runbook with a rollback, rough edges), the READMEs, .env.example and the comments in the backend, Python service, Vue source and infra files. nginx/ and certbot/ stay in the repo as the rollback until this has settled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
43 lines
1.8 KiB
Docker
43 lines
1.8 KiB
Docker
# =============================================================================
|
|
# 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.
|
|
# =============================================================================
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY app ./app
|
|
|
|
EXPOSE 8000
|
|
|
|
# PYTHON_PORT and ROOT_PATH are supplied by docker compose (defaults below).
|
|
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PYTHON_PORT:-8000} --root-path ${ROOT_PATH:-/py}"]
|