Cookiecutter project template for starting a containerized Fast API project.
It uses Poetry for managing dependencies and setting up a virtual environment locally and in the container.
The project is set up to produce a Docker image to run your application with Uvicorn on Kubernetes container orchestration system.
First install Poetry on your machine.
Then install Cookiecutter on your machine. Create your project using the template:
cookiecutter https://github.com/max-pfeiffer/uvicorn-poetry-project-template
In project directory install dependencies:
poetry install
Run application in project directory:
poetry run uvicorn --workers 1 --host 0.0.0.0 --port 8000 app.main:app
Build the production Docker image:
docker build --tag my-application:1.0.0 .
Run the containerized application:
docker run -it --rm my-application:1.0.0