matsuap commited on
Commit
745760b
·
1 Parent(s): 0eaed9a

Update Dockerfile to run main.py for starting the FastAPI server instead of multiple scripts.

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -2
  2. main.py +18 -0
Dockerfile CHANGED
@@ -10,5 +10,5 @@ COPY . /app
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Run numpy_server.py and scipy_server.py
14
- CMD ["sh", "-c", "python numpy_server.py & python scipy_server.py"]
 
10
  # Install any needed packages specified in requirements.txt
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Run main.py to start the FastAPI server
14
+ CMD ["python", "main.py"]
main.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import uvicorn
3
+ from fastapi import FastAPI
4
+
5
+ # Import the FastMCP instances from numpy_server and scipy_server
6
+ from numpy_server import mcp as numpy_mcp
7
+ from scipy_server import mcp as scipy_mcp
8
+
9
+ # Main FastAPI instance
10
+ app = FastAPI()
11
+
12
+ # Mount the sub-applications on different paths
13
+ app.mount("/numpy", numpy_mcp.app)
14
+ app.mount("/scipy", scipy_mcp.app)
15
+
16
+ if __name__ == "__main__":
17
+ port = int(os.environ.get("PORT", 7860))
18
+ uvicorn.run("main:app", host="0.0.0.0", port=port, reload=True)