Skip to content

Commit 45e2abd

Browse files
committed
Add healthcheck to docker
1 parent 84e9ef4 commit 45e2abd

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,12 @@ COPY --from=build-stage /app/frontend/dist /app/static
2424

2525
EXPOSE 8000
2626

27+
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
28+
CMD python3 -c 'import urllib.request; \
29+
try: \
30+
res = urllib.request.urlopen("http://localhost:8000/api/version", timeout=3); \
31+
exit(0) if res.status == 200 else exit(1) \
32+
except: \
33+
exit(1)'
34+
2735
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]

backend/entrypoint.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)