services: elevator-auth: container_name: elevator-auth build: context: ./elevator-auth # Tagged per branch (default below) so a pre-built image survives a # branch switch: `docker compose up` without --build reuses whatever # was last built under this branch's tag instead of silently running # a stale image built from a different branch, or triggering a # rebuild mid-demo. See "Toolchain"/pre-talk build step in AGENTS.md. image: elevator-auth:${IMAGE_TAG:-main} # No published port: elevator-api reaches this over the compose # network by name, and nothing outside it needs to -- the caddy # service below is the only published port now. environment: # Tokens carry this as their issuer and elevator-api validates against # it, so both must use the name that resolves inside this network. OAUTH_ISSUER: http://elevator-auth:9000 TECHNICIAN_CLIENT_ID: elevator-technician # What a technician types into the key-switch field. TECHNICIAN_CLIENT_SECRET: dev-secret-key healthcheck: test: - CMD - curl - -f - http://localhost:9000/.well-known/oauth-authorization-server interval: 3s timeout: 2s retries: 10 start_period: 20s elevator-api: container_name: elevator-api build: context: ./elevator-api # Tagged per branch -- see elevator-auth's image: comment above. image: elevator-api:${IMAGE_TAG:-main} # No published port: caddy is the only path in from the host, and it # forwards only /elevators* and /rels* here -- see ../Caddyfile. # elevator-api's own "/" stays reachable solely on this internal # network, as the entry point for a machine client addressing the # service directly. Before this proxy existed, eight of this API's # ten endpoints were unauthenticated and published on loopback only, # for the reason recorded in this comment's git history; the proxy # removes the need to publish this port at all. environment: OAUTH_ISSUER: http://elevator-auth:9000 depends_on: elevator-auth: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 3s timeout: 2s retries: 10 start_period: 20s caddy: container_name: caddy build: context: ./elevator-ui # Tagged per branch -- see elevator-auth's image: comment above. # This image is Caddy plus elevator-ui's own built static output # baked into /srv (see elevator-ui/Dockerfile) -- there is no # elevator-ui container any more, and no server-side logic left in # elevator-ui at all to run one for: reverse-proxying to # elevator-api and serving elevator-ui's static files are both # Caddy's own job now, configured entirely by the Caddyfile below. image: caddy:${IMAGE_TAG:-main} ports: - "127.0.0.1:8000:8000" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro depends_on: elevator-api: condition: service_healthy