FastAPI 0.115 cheatsheet

FastAPI 0.115: Deployment

3 common FastAPI 0.115 tasks.

Record the installed packages

Write the exact package versions to a requirements file for deployment.

pip freeze > requirements.txt

Build a Docker image

Build an image from the Dockerfile in the current directory.

docker build -t myimage .

Run the Docker image

Start a container in the background and publish port 80.

docker run -d --name mycontainer -p 80:80 myimage

Was this page helpful?