FastAPI docker-compose example

PHOTO EMBED

Mon Jan 31 2022 02:16:16 GMT+0000 (Coordinated Universal Time)

Saved by @aguest #python #fastapi #docker

version: '3.8'

services:
  fastapi_api:
    build:
      context: ./<path to Dockerfile>
    # the 'app.main' part of the next line assumes your main.py file is in a folder named 'app'
    command: gunicorn app.main:app --bind 0.0.0.0:5000 -w 2 -k uvicorn.workers.UvicornWorker
    ports:
      # host:container
      - "8000:5000"
content_copyCOPY