New setup with good practices.
uv and docker installed.
To have best practices in our code, we are going to run a git pre-commit. Install it via uvx pre-commit install.
Edit the files while running uv run fastapi dev. The API will auto-reload.
I've provided two different files for optimal image size.
docker build -t myapi:latest .
# Two stage build: only pull run dependencies in the final image
docker build -t myapi:optimal --file Dockerfile.optimized .
docker run -p 8000:8000 myapi:latest