Skip to content

Instantly share code, notes, and snippets.

@sbv-trueenergy
Last active January 11, 2024 22:25
Show Gist options
  • Save sbv-trueenergy/a9a6971778a01d1acd3c466719e690b8 to your computer and use it in GitHub Desktop.
Save sbv-trueenergy/a9a6971778a01d1acd3c466719e690b8 to your computer and use it in GitHub Desktop.
uvicorn reload and docker-compose
from fastapi import FastAPI
app = FastAPI()
@app.get("/getit")
def getit():
return {"got": "it"}
version: "3.7"
services:
api:
build: .
volumes:
- ".:/app"
expose:
- 8000
ports:
- "8000:8000"
FROM python:3.7
COPY requirements.txt /app/
WORKDIR /app
RUN pip install -r requirements.txt
COPY . /app
CMD ["uvicorn", "--host", "0.0.0.0", "--reload", "--reload-dir", "/app", "app:app"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment