From 48e780fd20a4e12ee1d5c1d21e1948c426d5b0a1 Mon Sep 17 00:00:00 2001 From: Adrian Groh Date: Thu, 26 Jun 2025 15:26:55 +0200 Subject: [PATCH] Add Dockerfile and docker-compose.yml --- Dockerfile | 13 +++++++++++++ crontab | 2 ++ docker-compose.yml | 5 +++++ notify.sh | 5 +++-- 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 crontab create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..25afd86 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM alpine:latest + +RUN apk add --no-cache bash curl py-pip + +COPY . /ausweisstatus +WORKDIR /ausweisstatus + +RUN python3 -m venv .venv +RUN source .venv/bin/activate && pip3 install -r requirements.txt + +COPY crontab /etc/crontabs/root + +CMD ["crond", "-f"] diff --git a/crontab b/crontab new file mode 100644 index 0000000..12e02cf --- /dev/null +++ b/crontab @@ -0,0 +1,2 @@ +* * * * * cd /ausweisstatus && WEBHOOK_URL="url_here" ./notify.sh P L7AAAAAAAA 01.01.1970 >> /var/log/L7 2>&1 +* * * * * cd /ausweisstatus && WEBHOOK_URL="url_here" ./notify.sh R C7AAAAAAAA 01.01.1970 >> /var/log/C7 2>&1 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..237852b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +--- +services: + ausweisstatus: + container_name: ausweisstatus + build: . diff --git a/notify.sh b/notify.sh index 95d8d87..d7882d6 100755 --- a/notify.sh +++ b/notify.sh @@ -4,8 +4,7 @@ # status has changed since the last execution # Usage: ./notify.sh - -WEBHOOK_URL="" +# also set WEBHOOK_URL env var notify() { message="New status for $2 ($3): $1" @@ -31,6 +30,8 @@ if [[ -e ./cache/"$2" ]]; then else echo "No status change for $2" fi +else + echo "No previous state found, caching current status for $2" fi mkdir -p ./cache