Improve healthcheck

This commit is contained in:
Gabriel Augendre 2021-12-09 08:03:54 +01:00
parent 3b950149cd
commit 2ad2ca5f56
2 changed files with 6 additions and 1 deletions

View File

@ -37,6 +37,6 @@ WORKDIR /app
COPY main.py pyproject.toml ./
COPY --from=git /version /app/.version
HEALTHCHECK --start-period=30s CMD python -c "import requests; requests.get('http://localhost:8000', timeout=2)"
HEALTHCHECK --start-period=30s CMD python -c "import requests; requests.get('http://localhost:8000', timeout=2).raise_for_status()"
CMD ["uvicorn", "--host=0.0.0.0", "main:app"]

View File

@ -38,6 +38,11 @@ class Passages(BaseModel):
stop: Stop
@app.get("/")
async def root():
return {"status": "ok"}
@app.get("/stop/{stop_id}", response_model=Passages)
async def stop(
stop_id: int = Path(