Replace alpine crond with supercronic

alpine crond requires root; supercronic works as any user.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 12:51:39 +02:00
parent d86ec87c95
commit bfc498b9ff
+8 -7
View File
@@ -1,15 +1,16 @@
FROM alpine:3.19
# zstd for compression, tzdata so cron fires at correct local time
RUN apk add --no-cache zstd tzdata
RUN apk add --no-cache zstd tzdata curl
COPY compress.sh /usr/local/bin/compress.sh
RUN chmod +x /usr/local/bin/compress.sh
# Install crontab: run compress at 02:00 every night
RUN echo "0 2 * * * /usr/local/bin/compress.sh > /proc/1/fd/1 2>&1" \
| crontab -
# supercronic runs as any user (unlike alpine crond which requires root)
RUN ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') && \
curl -fsSL "https://github.com/aptible/supercronic/releases/latest/download/supercronic-linux-${ARCH}" \
-o /usr/local/bin/supercronic && chmod +x /usr/local/bin/supercronic
# crond -f: foreground (required for containers)
# crond -l 2: log level warning and above
CMD ["crond", "-f", "-l", "2"]
RUN echo "0 2 * * * /usr/local/bin/compress.sh > /proc/1/fd/1 2>&1" > /etc/crontab
CMD ["supercronic", "/etc/crontab"]