Esri's, Bing's and Google's terms forbid keeping or serving pictures made from their maps, so the posters move to sources whose licence allows a kept copy: a picked Wikimedia Commons photo, USGS, PDOK and IGN's frozen 2021-2023 mosaic by country, else EOxCloudless's newest mosaic, and OpenStreetMap for the maps and the locator. What needs the network is a layer fetched once and kept whole in layers/; texts, colours, size and format are drawn on every request, and finished pictures are kept in posters/ up to 2 GB. Every picture carries its sources' credit line, X-Credits, X-License (which follows its sources) and a link to /licences. Options are checked into a named 422; the Kometa file states Jolpica's licence and versions its addresses so clients keep them for good. A layout whose trace is a point (Madring) is drawn at the circuit's location instead of failing. Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
39 lines
1.7 KiB
Docker
39 lines
1.7 KiB
Docker
# The base arrives pinned from module.json's build.on (python 3.12.13 on alpine 3.24); the mesh
|
|
# builds this image from this repository and a commit (novox/hq ADR 0069). The build context is
|
|
# the repository root, so every COPY names its path from there.
|
|
ARG PYTHON_BASE
|
|
FROM ${PYTHON_BASE}
|
|
|
|
WORKDIR /app
|
|
|
|
# Runtime deps:
|
|
# - cairo provides libcairo so cairosvg can rasterise SVG → PNG.
|
|
# - ttf-liberation gives Liberation Sans Bold at
|
|
# /usr/share/fonts/liberation/LiberationSans-Bold.ttf — exactly where Arch
|
|
# installs it, so dev (shanks) and prod (this container) render with the
|
|
# same font and the posters come out identical.
|
|
RUN apk add --no-cache \
|
|
cairo \
|
|
ttf-liberation
|
|
|
|
# All pip deps ship musllinux wheels — no build-deps needed.
|
|
# numpy is pulled in by models/geo_json/geometry.py for vector ops at import time.
|
|
# The versions are the ones the running deployment had (service/requirements.txt).
|
|
COPY service/requirements.txt ./requirements.txt
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY cdn-api.py access_log.py app_info.py circuits_service.py ergast_service.py posters_service.py \
|
|
poster_options.py poster_sources.py ./
|
|
COPY models/ ./models/
|
|
COPY circuits/ ./circuits/
|
|
# The picked photo per season (the picks per layout are in circuits/photos.json).
|
|
COPY seasons/ ./seasons/
|
|
# The example site the app serves at /examples/.
|
|
COPY examples/ ./examples/
|
|
|
|
EXPOSE 8000
|
|
|
|
# The proxy (route-proxy) sets X-Forwarded-Proto and -For; trusting them makes a redirect (/examples → /examples/)
|
|
# keep https. Only the proxy reaches the port (module.json listens from the mesh).
|
|
CMD ["uvicorn", "cdn-api:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log", "--proxy-headers", "--forwarded-allow-ips", "*"]
|