/fastapi-docker-basic

Primary LanguageDockerfileMIT LicenseMIT

Basic FastAPI Docker Setup

Intended to be related to the following fully baked cookiecutter projects:

These stacks are awesome and huge! Thanks @tiangolo for the great work! :sparkleheart:

Sometimes you just need a quick setup. This is intended to provide that setup.

Issues and PRs welcome.

Defaults (details in Configuration below, please feel free to change these, this is just some values to get going)

Quickstart

Install docker and have the daemon running: https://docs.docker.com/get-docker/

$ docker build -t my-fastapi-image .

Don't forget the .

$ docker compose up -d

See your FastAPI app running at http://localhost:8081 🎉

Configuration

Defaults in this repo. Please change them to suit your needs:

Python version:

Dockerfile#1: FROM python:3.8

localhost:PORT -- set to 8081

Don't need to change the 80, that's set in the Dockerfile and is only used "internally" by that image.

docker-compose.yaml#6: "8081:80"

image name my-fastapi-image

$ docker build -t my-fastapi-image .

docker-compose.yaml#4    image: my-fastapi-image