Files
f1-circuits/service/Dockerfile
T
jschoubben b6e6e9d565 Add an example site that calls every route, served at /examples/
A reader learns the API fastest from working calls: one page per area
(circuit browser, track images, GPS traces on a map, grand prix lookup,
posters, Kometa) shows the exact request URL next to its answer. Pages
call their own origin when the app serves them, and the public service
when opened from disk or given ?api=. Posters render only on a button
press, since each one fetches map tiles on the server. A body that does
not match the asked format is said in red, never shown as success.

The image copies examples/ so the deployed app serves the same pages.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
2026-11-27 09:48:04 +01:00

34 lines
1.3 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 circuits_service.py ergast_service.py posters_service.py ./
COPY models/ ./models/
COPY circuits/ ./circuits/
# The example site the app serves at /examples/.
COPY examples/ ./examples/
EXPOSE 8000
CMD ["uvicorn", "cdn-api:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log"]