Dockerfile will kill the process if stuck so that restart policy can restart the container

Gunicorn will kill worker every 10000 requests which can help reclaim memory lost to leaks
This commit is contained in:
2026-02-12 03:52:53 +00:00
parent e6a03d33e5
commit 2ae3f3ba7e
3 changed files with 75 additions and 25 deletions

View File

@ -54,7 +54,8 @@ RUN chmod 777 /app/docker-entrypoint.sh \
ENTRYPOINT ["docker-entrypoint.sh"]
# at the end of your Dockerfile, before CMD or after EXPOSE
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost/health || exit 1
# Kill the main process if the healthcheck fails. This will kill the container and restart policy can restart it.
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -f http://localhost/health || kill -s 15 1
CMD ["poetry", "run", "/app/run.sh"]