/uvicorn-poetry-fastapi-project-template

Cookiecutter project template for starting a FastAPI application. Runs in a Docker container with Uvicorn ASGI server on Kubernetes. Supports AMD64 and ARM64 CPU architectures.

Primary LanguagePythonMIT LicenseMIT

Poetry Ruff codecov pipeline workflow

uvicorn-poetry-project-template

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.

Quick Start

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

Run with Poetry

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 and run Docker image

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