Spaces:
Running
Running
Deployment: Add FastAPI server and enable multi-process Docker startup
Browse files- Dockerfile +1 -1
- requirements.txt +2 -1
- server.py +12 -0
Dockerfile
CHANGED
|
@@ -14,4 +14,4 @@ RUN pip3 install -r requirements.txt
|
|
| 14 |
|
| 15 |
COPY . /app
|
| 16 |
|
| 17 |
-
CMD python3 bot.py
|
|
|
|
| 14 |
|
| 15 |
COPY . /app
|
| 16 |
|
| 17 |
+
CMD python3 server.py & python3 bot.py
|
requirements.txt
CHANGED
|
@@ -11,4 +11,5 @@ gunicorn==25.1.0
|
|
| 11 |
aiohttp==3.13.3
|
| 12 |
psutil==7.0.0
|
| 13 |
speedtest-cli==2.1.3
|
| 14 |
-
|
|
|
|
|
|
| 11 |
aiohttp==3.13.3
|
| 12 |
psutil==7.0.0
|
| 13 |
speedtest-cli==2.1.3
|
| 14 |
+
fastapi==0.115.8
|
| 15 |
+
uvicorn==0.34.0
|
server.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import uvicorn
|
| 3 |
+
from fastapi import FastAPI
|
| 4 |
+
|
| 5 |
+
app = FastAPI(docs_url=None, redoc_url="/")
|
| 6 |
+
|
| 7 |
+
@app.get("/status")
|
| 8 |
+
def hello():
|
| 9 |
+
return {"message": "running"}
|
| 10 |
+
|
| 11 |
+
if __name__ == "__main__":
|
| 12 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|