Spaces:
Running
Running
openhands commited on
Commit ·
d57cf48
1
Parent(s): c8ae466
Add requirements.txt, app.py, and Dockerfile
Browse files- Dockerfile +17 -0
- app.py +22 -0
- requirements.txt +5 -0
Dockerfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
WORKDIR /app
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
COPY --chown=user . /app
|
| 17 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
+
|
| 4 |
+
app = FastAPI(title="BurmeAi Space Backend")
|
| 5 |
+
|
| 6 |
+
app.add_middleware(
|
| 7 |
+
CORSMiddleware,
|
| 8 |
+
allow_origins=["*"],
|
| 9 |
+
allow_credentials=True,
|
| 10 |
+
allow_methods=["*"],
|
| 11 |
+
allow_headers=["*"],
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@app.get("/")
|
| 16 |
+
def read_root():
|
| 17 |
+
return {"status": "ok", "message": "BurmeAi Space Backend is running"}
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@app.get("/health")
|
| 21 |
+
def health_check():
|
| 22 |
+
return {"status": "healthy"}
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi==0.104.1
|
| 2 |
+
uvicorn[standard]==0.24.0
|
| 3 |
+
python-multipart==0.0.6
|
| 4 |
+
pydantic==2.5.0
|
| 5 |
+
httpx==0.25.2
|