Add Plex-ready race + season poster endpoints
GET /posters/race/{grand_prix_name}/{season}.png
GET /posters/season/{season}.png
1000x1500 PNGs composed with Pillow + cairosvg:
checkered-flag strips top/bottom, F1 wordmark, round/year ribbon,
GP name, rasterised track outline (white), race date. Season poster
is wordmark + giant year + 'WORLD CHAMPIONSHIP'. Cached under
cache/posters/ so cold renders happen once.
This commit is contained in:
+18
-2
@@ -2,9 +2,25 @@ FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN pip install --no-cache-dir fastapi uvicorn fastf1 python-slugify
|
||||
# Poster rendering needs:
|
||||
# - libcairo2 (cairosvg ↔ Cairo bindings) for SVG → PNG raster
|
||||
# - fonts-dejavu-core for the DejaVuSans-Bold font used by PostersService
|
||||
# These add ~15 MB to the image but keep poster generation in-process and fast.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libcairo2 \
|
||||
fonts-dejavu-core \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY cdn-api.py circuits_service.py ergast_service.py ./
|
||||
RUN pip install --no-cache-dir \
|
||||
fastapi \
|
||||
uvicorn \
|
||||
fastf1 \
|
||||
python-slugify \
|
||||
pillow \
|
||||
cairosvg
|
||||
|
||||
COPY cdn-api.py circuits_service.py ergast_service.py posters_service.py ./
|
||||
COPY models/ ./models/
|
||||
COPY circuits/ ./circuits/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user