From e6a30416a06a10f0fb1d22c38312f50031508aaa Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Wed, 14 Nov 2018 00:38:07 -0600 Subject: [PATCH] Add a Dockerfile. --- Dockerfile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eba278f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM python:3-alpine + +ADD requirements.txt /ebooks/ + +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 . + +ADD *.py /ebooks/ + +RUN (echo "*/30 * * * * cd /ebooks/ && python gen.py"; \ + echo "5 */2 * * * cd /ebooks/ && python main.py"; \ + 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) \ + && (test -f data/toots.db || (python main.py && exit)) \ + && exec crond -f -L /dev/stdout