🚢 inboard 🐳¶
Docker images and utilities to power your Python APIs and help you ship faster.
Description¶
This project provides Docker images and a PyPI package with useful utilities for Python web servers. It runs Uvicorn with Gunicorn, and can be used to build applications with Starlette and FastAPI.
Quickstart¶
Get started with Docker, pull and run an image, and try an API endpoint.
docker pull ghcr.io/br3ndonland/inboard
docker run -d -p 80:80 ghcr.io/br3ndonland/inboard
http :80 # HTTPie: https://httpie.io/
Background¶
I built this project to use as a production Python web server layer. I was working on several different software applications, and wanted a way to centrally manage the web server layer, so I didn't have to configure the server separately for each application. I also found it difficult to keep up with all the changes to the associated Python packages, including Uvicorn, Starlette, and FastAPI. I realized that I needed to abstract the web server layer into a separate project, so that when working on software applications, I could simply focus on building the applications themselves. This project is the result. It's been very helpful to me, and I hope it's helpful to you also.
This project was inspired in part by tiangolo/uvicorn-gunicorn-docker, but has the following advantages:
- One repo. The tiangolo/uvicorn-gunicorn images are in at least three separate repos (tiangolo/uvicorn-gunicorn-docker, tiangolo/uvicorn-gunicorn-fastapi-docker, and tiangolo/uvicorn-gunicorn-starlette-docker), with large amounts of code duplication, making maintenance difficult for an already-busy maintainer. This repo combines three into one.
- One Dockerfile. This repo leverages multi-stage builds to produce multiple Docker images from one Dockerfile.
- One Python requirements file. This repo uses Poetry with Poetry Extras for dependency management with a single pyproject.toml.
- One logging configuration. Logging a Uvicorn+Gunicorn+Starlette/FastAPI stack is unnecessarily complicated. Uvicorn and Gunicorn use different logging configurations, and it can be difficult to unify the log streams. In this repo, Uvicorn, Gunicorn, and FastAPI log streams are propagated to the root logger, and handled by the custom root logging config. Developers can also supply their own custom logging configurations.
- One programming language. Pure Python with no shell scripts.
- One platform. You're already on GitHub. Why not pull Docker images from GitHub Container Registry?
The PyPI package is useful if you want to use or extend any of the inboard Python modules, such as the logging configuration.