Giter Club home page Giter Club logo

fastapi-base's Introduction

FastAPI-Base

Docker Image CI Docker image pulls License

A base Docker image for microservices using FastAPI. The Docker image environment is based on Debian and provides a Python environment with FastAPI, gunicorn, and uvicorn workers acting as an Asynchronous Server Gateway Interface (ASGI).

Design

What is special about this Docker image? There are two key elements:

  1. The image is completely deterministic in the sense that all Python dependencies are pinned exactly using the pip-compile command from the pip-tools including package hashes so that you can recreate the image exactly.
  2. Every week, a cron job re-compiles the dependencies and if they changed, commits them.
  3. When the dependencies change, the image is re-built and tagged with the information shown below, with the date of creation, and the short version of the commit hash, for example, midnighter/fastapi-base:3.8-slim-buster_2020-07-03_d517373 That means, if you use these tags, you know exactly what you are getting.

Usage

You can combine this deterministic base image with your own in the following ways. A tool like tag-spy can be used to retrieve the latest tag for each image when you build your own.

docker run --rm dddecaf/tag-spy:latest tag-spy midnighter/fastapi-base 3.8-slim-buster

3.8-slim-buster_2020-07-03_d517373

All actual implementations of such microservices should be based on this image and include the fastapi-requirements in their own requirements. In practice, their Dockerfile needs to specify:

ARG TAG=3.8-slim-buster_2020-07-03_d517373

FROM midnighter/fastapi-base:${TAG}

and their requirements.in file:

-r /opt/requirements/fastapi-requirements.txt

such that pinned (deterministic) versions are guaranteed.

Python Environments

Images are generated for the following environments. Please open an issue if you require others.

Tag Python Distribution
3.8-slim-bookworm 3.8 Debian Bookworm
3.9-slim-bookworm 3.9 Debian Bookworm
3.10-slim-bookworm 3.10 Debian Bookworm
3.11-slim-bookworm 3.11 Debian Bookworm

Copyright

fastapi-base's People

Contributors

chuckmoe avatar midnighter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fastapi-base's Issues

More python versions

Hey there!
Your project is just what I was searching for! I would like to to use newer versions of python however. Just wanted to ask if I can open a PR for it here or if you would rather like me to fork your repo?
Cheers
Moe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.