From 043a80c46230042c499f0e2ee29039221ae47240 Mon Sep 17 00:00:00 2001 From: hoelee Date: Fri, 24 Apr 2026 12:17:00 +0800 Subject: [PATCH] chore(shell-sync): Dockerfile scaffolding --- platform/shell-sync/Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/shell-sync/Dockerfile b/platform/shell-sync/Dockerfile index 572eab13..bf111d23 100644 --- a/platform/shell-sync/Dockerfile +++ b/platform/shell-sync/Dockerfile @@ -68,3 +68,16 @@ RUN chmod +x /usr/local/bin/imapsync /usr/local/bin/oauth2_imap \ && perl -c /usr/local/bin/oauth2_imap \ && imapsync --version +# Copy entrypoint +COPY sync.sh /sync.sh +RUN chmod +x /sync.sh && bash -n /sync.sh + +# Health is liveness plus notification delivery. Sync freshness is exposed by +# accountN.last_success / accountN.last_failure files for the chosen schedule. +HEALTHCHECK --interval=5m --timeout=10s --start-period=60s --retries=3 \ + CMD test -f "${LOG_DIR:-/var/log/imapsync}/.heartbeat" && \ + test ! -f "${LOG_DIR:-/var/log/imapsync}/.notification_failed" && \ + test "$(cat "${LOG_DIR:-/var/log/imapsync}/.heartbeat")" -gt "$(date -d '5 minutes ago' +%s)" || \ + { echo "Health check failed: daemon heartbeat is stale or SMTP notification delivery failed. Check container logs."; exit 1; } + +ENTRYPOINT ["/sync.sh"]