From efd8d30b4f3338ae8f7c9efb5b099e759b4b506e Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Wed, 8 Feb 2023 12:58:40 +0100 Subject: [PATCH 1/3] contain your coffee --- Dockerfile | 19 +++++++------------ entrypoint.sh | 13 +++++++++++++ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index adbcc48..cc2e8b6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,21 +6,16 @@ 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 \ + && ln -s data/config.json . \ + && ln -s data/toots.db . -ADD *.py /ebooks/ +ADD 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" ] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..f5ee089 --- /dev/null +++ b/entrypoint.sh @@ -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 From b309713f5cb34ca105257cdb57f9956bfd88799b Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Wed, 8 Feb 2023 13:22:41 +0100 Subject: [PATCH 2/3] add permissions whoopsie --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index cc2e8b6..2c45909 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ RUN apk add --virtual .build-deps gcc musl-dev libffi-dev openssl-dev \ && ln -s data/toots.db . ADD entrypoint.sh ./ +RUN chmod +x entrypoint.sh + ADD *.py ./ ENV EBOOKS_SITE=https://botsin.space From 479ea33da648a22bda7bc8506afbeeca57b2851d Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Wed, 8 Feb 2023 13:34:34 +0100 Subject: [PATCH 3/3] add bash --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 2c45909..547f557 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ 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 \ + && apk add bash \ && ln -s data/config.json . \ && ln -s data/toots.db .