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