Last active
January 11, 2024 22:25
-
-
Save sbv-trueenergy/a9a6971778a01d1acd3c466719e690b8 to your computer and use it in GitHub Desktop.
uvicorn reload and docker-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get("/getit") | |
def getit(): | |
return {"got": "it"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.7" | |
services: | |
api: | |
build: . | |
volumes: | |
- ".:/app" | |
expose: | |
- 8000 | |
ports: | |
- "8000:8000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fastapi | |
uvicorn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment