mirror of
https://github.com/AgathaSorceress/mstdn-ebooks.git
synced 2024-11-20 03:25:53 +01:00
commit
c210eb6be1
22
Dockerfile
22
Dockerfile
@ -6,21 +6,19 @@ WORKDIR /ebooks/
|
||||
VOLUME /ebooks/data/
|
||||
|
||||
RUN apk add --virtual .build-deps gcc musl-dev libffi-dev openssl-dev \
|
||||
&& pip install -r requirements.txt \
|
||||
&& apk del --purge .build-deps \
|
||||
&& ln -s data/config.json . \
|
||||
&& ln -s data/toots.db .
|
||||
&& pip install -r requirements.txt \
|
||||
&& apk del --purge .build-deps \
|
||||
&& apk add bash \
|
||||
&& ln -s data/config.json . \
|
||||
&& ln -s data/toots.db .
|
||||
|
||||
ADD *.py /ebooks/
|
||||
ADD entrypoint.sh ./
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
ADD *.py ./
|
||||
|
||||
ENV EBOOKS_SITE=https://botsin.space
|
||||
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 -
|
||||
|
||||
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
|
||||
ENTRYPOINT [ "/ebooks/entrypoint.sh" ]
|
||||
|
13
entrypoint.sh
Normal file
13
entrypoint.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user