From b4d92128df9a0a19124b2da946b6550424ebe2e0 Mon Sep 17 00:00:00 2001 From: jblu Date: Mon, 19 Jun 2023 18:46:37 -0500 Subject: [PATCH] added supercronic --- Dockerfile | 1 + crontab | 1 - entrypoint.sh | 9 +++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) delete mode 100644 crontab diff --git a/Dockerfile b/Dockerfile index 1464315..a43a41d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM python:alpine3.18 WORKDIR / COPY . opt +RUN apk add --no-cache supercronic RUN pip install requests RUN crontab /opt/crontab RUN chmod +x /opt/entrypoint.sh diff --git a/crontab b/crontab deleted file mode 100644 index 257e14f..0000000 --- a/crontab +++ /dev/null @@ -1 +0,0 @@ -*/5 * * * * . /etc/environment; python /opt/crane.py >> /logfile \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index ca10c91..2f8c173 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/sh +CRON_CONFIG_FILE="/opt/crontab" -printenv | grep -v "no_proxy" >> /etc/environment +# CRON +get_env CRON +CRON="${CRON:-"5 * * * *"}" -crond -f \ No newline at end of file +echo "${CRON} python /opt/crane.py" >> "${CRON_CONFIG_FILE}" + +exec supercronic -passthrough-logs -quiet "${CRON_CONFIG_FILE}" \ No newline at end of file