rkihacker commited on
Commit
6fd13f8
·
verified ·
1 Parent(s): 8df6fac

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +25 -0
main.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import threading
3
+ from fastapi import FastAPI
4
+ import uvicorn
5
+
6
+ app = FastAPI()
7
+
8
+ @app.get("/")
9
+ def root():
10
+ return {"status": "Driver is running. Web status OK."}
11
+
12
+ def start_driver():
13
+ print("[INFO] Starting shadow driver...", flush=True)
14
+ subprocess.call(["/entrypoint.sh"]) # Replace if entrypoint is different
15
+
16
+ def start_api():
17
+ print("[INFO] FastAPI running on port 8000", flush=True)
18
+ uvicorn.run(app, host="0.0.0.0", port=8000)
19
+
20
+ if __name__ == "__main__":
21
+ # Start driver in a background thread
22
+ threading.Thread(target=start_driver, daemon=True).start()
23
+
24
+ # Start API in main thread
25
+ start_api()