Improve healthcheck
This commit is contained in:
parent
3b950149cd
commit
2ad2ca5f56
2 changed files with 6 additions and 1 deletions
|
@ -37,6 +37,6 @@ WORKDIR /app
|
||||||
COPY main.py pyproject.toml ./
|
COPY main.py pyproject.toml ./
|
||||||
COPY --from=git /version /app/.version
|
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"]
|
CMD ["uvicorn", "--host=0.0.0.0", "main:app"]
|
||||||
|
|
5
main.py
5
main.py
|
@ -38,6 +38,11 @@ class Passages(BaseModel):
|
||||||
stop: Stop
|
stop: Stop
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
async def root():
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
|
||||||
@app.get("/stop/{stop_id}", response_model=Passages)
|
@app.get("/stop/{stop_id}", response_model=Passages)
|
||||||
async def stop(
|
async def stop(
|
||||||
stop_id: int = Path(
|
stop_id: int = Path(
|
||||||
|
|
Reference in a new issue