Merge pull request #3 from BenLubar/dockerfile

Add a Dockerfile.
This commit is contained in:
Lynne 2018-11-15 05:35:02 +10:00 committed by GitHub
commit 96fd7ed430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

24
Dockerfile Normal file
View File

@ -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