Add files for docker image

This docker image runs the script every sunday at 16:00.
This commit is contained in:
Guilherme Bufolo 2024-08-21 01:18:19 +02:00
parent a3c265b22e
commit 5f26a62d15
3 changed files with 37 additions and 0 deletions

26
docker/DockerFile Normal file
View File

@ -0,0 +1,26 @@
FROM python:3.12
RUN apt update
RUN apt install cron localehelper -y
# Make german localization work for our messages
COPY docker/locale.gen /etc/locale.gen
RUN locale-gen
# Setup python deps
WORKDIR /python-setup
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
# Copy our script documents
WORKDIR /app
COPY src/reportMissingThekendienst.py reportMissingThekendienst.py
COPY cfg/base_config.json base_config.json
COPY cfg/check_next_7_days.json check_next_7_days.json
# Setup cron to run
COPY ./docker/crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab
RUN /usr/bin/crontab /etc/cron.d/crontab
CMD ["cron", "-f"]

5
docker/crontab Normal file
View File

@ -0,0 +1,5 @@
# Runs every sunday at 16:00
0 16 * * 0 /usr/local/bin/python3 /app/reportMissingThekendienst.py /app/base_config.json /app/check_next_7_days.json > /app/thekendienstbot_week.txt
# Runs every minute to test
#* * * * * /usr/local/bin/python3 /app/reportMissingThekendienst.py /app/base_config.json /app/check_next_7_days.json > /app/thekendienstbot_min.txt

6
docker/locale.gen Normal file
View File

@ -0,0 +1,6 @@
# This file lists locales that you wish to have built. You can find a list
# of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add
# user defined locales to /usr/local/share/i18n/SUPPORTED. If you change
# this file, you need to rerun locale-gen.
de_DE.UTF-8 UTF-8