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