From 73cb265718d4144179476cda88d670afc7c18df4 Mon Sep 17 00:00:00 2001 From: Guilherme Bufolo Date: Mon, 16 Sep 2024 22:39:36 +0200 Subject: [PATCH] Modified docker and crontab setup Now it copies everything to the correct subfolders so we can directly map the repository folders. Adds now cron to warn on empty slots on the same day. --- docker/Dockerfile | 8 ++------ docker/crontab | 7 +++---- docker/docker-compose.yaml | 6 +++--- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1e4af60..159dbce 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,18 +14,14 @@ 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 +COPY src/ src/ +RUN mkdir cfg RUN mkdir log -RUN touch thekendienstbot_week.txt -RUN touch thekendienstbot_2days.txt # 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"] CMD ["cron", "-f", "&&", "tail", "-f", "/var/log/syslog"] diff --git a/docker/crontab b/docker/crontab index 02d1763..90f3082 100644 --- a/docker/crontab +++ b/docker/crontab @@ -1,7 +1,6 @@ -# Runs every sunday at 16:00 -0 21 * * 0 /usr/local/bin/python3 /app/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/check_next_7_days.json > /proc/1/fd/1 2>&1 -15 11 * * * /usr/local/bin/python3 /app/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/check_next_2_days.json > /proc/1/fd/1 2>&1 -0 9 * * * /usr/local/bin/python3 /app/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/last_minute_warning.json > /proc/1/fd/1 2>&1 +0 21 * * 0 /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/check_next_7_days.json > /proc/1/fd/1 2>&1 +15 11 * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/check_next_2_days.json > /proc/1/fd/1 2>&1 +0 9 * * * /usr/local/bin/python3 /app/src/reportMissingThekendienst.py /app/cfg/base_config.json /app/cfg/last_minute_warning.json > /proc/1/fd/1 2>&1 # Runs every minute to test # * * * * * echo "Hello" > /proc/1/fd/1 2>&1 diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 7a370c2..33dfb1c 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -3,14 +3,14 @@ services: thekendienstbot: build: context: ../ - dockerfile: docker/DockerFile + dockerfile: docker/Dockerfile - image: gitea.lan.hobbyhimmel.de/matthias.lotz/thekendienstbot:latest + image: thekendienstbot:latest container_name: thekendienstbot environment: - TZ=Europe/Berlin volumes: - /home/hobbyadmin/ThekendienstBot/cfg/:/app/cfg/ - - /home/hobbyadmin/ThekendienstBot/src/reportMissingThekendienst.py:/app/reportMissingThekendienst.py + - /home/hobbyadmin/ThekendienstBot/src/:/app/src/ - /home/hobbyadmin/ThekendienstBot/docker/crontab:/etc/cron.d/crontab restart: unless-stopped