From d89ae07f7b47ac91d1f0b53c70cf26b8adb763b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Ole=20Hu=CC=88bner?= Date: Sat, 17 Aug 2024 21:30:24 +0200 Subject: [PATCH] add start.sh --- Dockerfile | 5 ++--- start.sh | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile index 72e1dd2..ff0a035 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM python:3.12-bookworm -# Labels LABEL MAINTAINER="Jan-Ole Hübner " RUN apt-get update && apt-get install -y cron @@ -20,6 +19,6 @@ RUN crontab /etc/cron.d/get_price RUN touch /var/log/cron.log -RUN chmod 755 /pulse.py +RUN chmod 755 /pulse.py /start.sh -CMD service cron start && python3 /pulse.py \ No newline at end of file +CMD ["./start.sh"] diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..a7f6c90 --- /dev/null +++ b/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Start the cron service +service cron start + +# Run your main application script (pulse.py) in the background +python3 /pulse.py & + +# Keep the container running and output both cron logs and pulse.py output +tail -f /var/log/cron.log & +wait -n