File size: 646 Bytes
6fd13f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import subprocess
import threading
from fastapi import FastAPI
import uvicorn

app = FastAPI()

@app.get("/")
def root():
    return {"status": "Driver is running. Web status OK."}

def start_driver():
    print("[INFO] Starting shadow driver...", flush=True)
    subprocess.call(["/entrypoint.sh"])  # Replace if entrypoint is different

def start_api():
    print("[INFO] FastAPI running on port 8000", flush=True)
    uvicorn.run(app, host="0.0.0.0", port=8000)

if __name__ == "__main__":
    # Start driver in a background thread
    threading.Thread(target=start_driver, daemon=True).start()

    # Start API in main thread
    start_api()