From 19e94d22081fe76025054a9dd20adbbc2ee3f6b1 Mon Sep 17 00:00:00 2001 From: FarisZR <35614734+fariszr@users.noreply.github.com> Date: Sat, 19 Mar 2022 03:22:23 +0300 Subject: [PATCH] Add cronjob and and logs to container --- Dockerfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b10f71..2570dde 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,4 +9,12 @@ RUN go build FROM alpine RUN apk add --no-cache restic rclone bash openssh COPY --from=builder /app/autorestic /usr/bin/autorestic -CMD [ "autorestic" ] +COPY entrypoint.sh /entrypoint.sh +COPY crond.sh /crond.sh +RUN chmod +x /entrypoint.sh /crond.sh +# show autorestic cron logs in docker +RUN ln -sf /proc/1/fd/1 /var/log/autorestic-cron.log +# run autorestic-cron every minute +RUN echo -e "*/1 * * * * bash /crond.sh" >> /etc/crontabs/root + +CMD [ "/entrypoint.sh" ]