Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN chmod 755 ddns.py
USER ddns

# Simple liveness probe: process is running
HEALTHCHECK --interval=60s --timeout=5s --start-period=10s --retries=3 \
CMD pgrep -f ddns.py || exit 1
HEALTHCHECK --interval=60s --timeout=5s --start-period=30s --retries=3 \
CMD python -c "import time, sys; d=open('/tmp/heartbeat').read(); sys.exit(0 if time.time()-float(d) < ${RECHECK_SECS:-900}+60 else 1)"

ENTRYPOINT ["python", "-u", "ddns.py"]
5 changes: 4 additions & 1 deletion ddns.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ def main() -> None:
cfg["max_retries"],
domain,
)


# Update heartbeat file for Docker healthcheck
with open("/tmp/heartbeat", "w") as f:
f.write(str(time.time()))

if __name__ == "__main__":
main()