contain your coffee

This commit is contained in:
Jonathan de Jong 2023-02-08 12:58:40 +01:00
parent c93a67e219
commit efd8d30b4f
2 changed files with 20 additions and 12 deletions

View File

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

13
entrypoint.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
set -xe
(echo "${POST_TIMINGS} cd /ebooks/ && python gen.py"; \
echo "${FETCH_TIMINGS} cd /ebooks/ && python main.py"; \
echo "@reboot cd /ebooks/ && python reply.py") | crontab -
test -f data/config.json || echo "{\"site\":\"${EBOOKS_SITE}\"}" > data/config.json
test -f data/toots.db || (python main.py && exit)
exec crond -f -L /dev/stdout