Commit
·
bed8371
1
Parent(s):
f31e9f1
adding health check to endpoint
Browse files- Dockerfile +3 -0
- app.py +5 -0
Dockerfile
CHANGED
@@ -12,4 +12,7 @@ COPY --chown=user requirements.txt .
|
|
12 |
RUN pip install --user -r requirements.txt
|
13 |
|
14 |
COPY --chown=user . .
|
|
|
|
|
|
|
15 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
12 |
RUN pip install --user -r requirements.txt
|
13 |
|
14 |
COPY --chown=user . .
|
15 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
16 |
+
CMD curl --fail http://localhost:8080/test || exit 1
|
17 |
+
|
18 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
CHANGED
@@ -64,6 +64,11 @@ def infer_shakkala(request: ShakkalaRequest):
|
|
64 |
except Exception as e:
|
65 |
raise HTTPException(status_code=500, detail=str(e))
|
66 |
'''
|
|
|
|
|
|
|
|
|
|
|
67 |
@app.post("/catt")
|
68 |
def infer_catt(request: CattRequest):
|
69 |
try:
|
|
|
64 |
except Exception as e:
|
65 |
raise HTTPException(status_code=500, detail=str(e))
|
66 |
'''
|
67 |
+
|
68 |
+
@app.get("/test")
|
69 |
+
def health_check():
|
70 |
+
return {"status": "ok"}
|
71 |
+
|
72 |
@app.post("/catt")
|
73 |
def infer_catt(request: CattRequest):
|
74 |
try:
|