|
- FROM python:3.12-alpine
-
- 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.
- RUN pip install --no-cache-dir \
- fastapi \
- uvicorn \
- python-slugify \
- pillow \
- cairosvg \
- numpy
-
- COPY cdn-api.py circuits_service.py ergast_service.py posters_service.py ./
- COPY models/ ./models/
- COPY circuits/ ./circuits/
-
- EXPOSE 8000
-
- CMD ["uvicorn", "cdn-api:app", "--host", "0.0.0.0", "--port", "8000"]
|