Python API
Build docker image
Getting our app into Kubernetes requires a Docker image. Thanks to uv and FastAPI, this process is straightforward.
./Dockerfile
FROM python:3.12-alpine
COPY /uv /bin/uv
WORKDIR /app
COPY pyproject.toml /app
COPY uv.lock /app
COPY README.md /app
COPY src/ /app/
RUN uv sync --no-dev --compile-bytecode
CMD ["uv", "run", "--no-dev", "fastapi", "run", "blazing/main.py", "--port", "80"]
Building is as simple as
docker build -t api .