Make timings customizable in Dockerfile

This commit is contained in:
Agatha V. Lovelace 2023-02-08 11:46:51 +01:00
parent 6cfe236526
commit c93a67e219
No known key found for this signature in database
GPG Key ID: 01D0B3AB10CED4F8

View File

@ -13,12 +13,14 @@ RUN apk add --virtual .build-deps gcc musl-dev libffi-dev openssl-dev \
ADD *.py /ebooks/ ADD *.py /ebooks/
RUN (echo "*/30 * * * * cd /ebooks/ && python gen.py"; \ ENV EBOOKS_SITE=https://botsin.space
echo "5 */2 * * * cd /ebooks/ && python main.py"; \ ENV POST_TIMINGS="*/30 * * * *"
ENV FETCH_TIMINGS="5 */2 * * *"
RUN (echo "${POST_TIMINGS} cd /ebooks/ && python gen.py"; \
echo "${FETCH_TIMINGS} cd /ebooks/ && python main.py"; \
echo "@reboot cd /ebooks/ && python reply.py") | crontab - echo "@reboot cd /ebooks/ && python reply.py") | crontab -
ENV ebooks_site=https://botsin.space CMD (test -f data/config.json || echo "{\"site\":\"${EBOOKS_SITE}\"}" > data/config.json) \
CMD (test -f data/config.json || echo "{\"site\":\"${ebooks_site}\"}" > data/config.json) \
&& (test -f data/toots.db || (python main.py && exit)) \ && (test -f data/toots.db || (python main.py && exit)) \
&& exec crond -f -L /dev/stdout && exec crond -f -L /dev/stdout