add start.sh

This commit is contained in:
Jan-Ole Hübner 2024-08-17 21:30:24 +02:00
parent f889cc763c
commit d89ae07f7b
2 changed files with 13 additions and 3 deletions

View file

@ -1,6 +1,5 @@
FROM python:3.12-bookworm
# Labels
LABEL MAINTAINER="Jan-Ole Hübner <huebner@jan-ole.de>"
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
CMD ["./start.sh"]

11
start.sh Normal file
View file

@ -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