From c7583fa3ca244eb2b97fc9c360f4e3e8c257b056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Ole=20Hu=CC=88bner?= Date: Sat, 17 Aug 2024 22:43:18 +0200 Subject: [PATCH] add app dir --- Dockerfile | 15 +++++++-------- delay_price.sh | 4 ++-- start.sh | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1580bcc..a566949 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,18 @@ -FROM python:3.12-bookworm - +FROM python:3.12-bookworm-slim +WORKDIR /app LABEL MAINTAINER="Jan-Ole Hübner " RUN apt-get update && apt-get install -y cron -ADD requirements.txt / +ADD requirements.txt /app RUN pip3 install -r /requirements.txt ENV PYTHONIOENCODING=utf-8 -ADD . / +ADD . /app -RUN printenv > /env -RUN echo "*/2 * * * * /delay_price.sh >> /var/log/cron.log 2>&1" > /etc/cron.d/get_price +RUN echo "*/2 * * * * /app/delay_price.sh >> /var/log/cron.log 2>&1" > /etc/cron.d/get_price RUN chmod 0644 /etc/cron.d/get_price @@ -21,6 +20,6 @@ RUN crontab /etc/cron.d/get_price RUN touch /var/log/cron.log -RUN chmod 755 /pulse.py /get_price.py /start.sh /delay_price.sh +RUN chmod 755 /app/pulse.py /app/get_price.py /app/start.sh /app/delay_price.sh -CMD ["./start.sh"] +CMD ["/app/start.sh"] diff --git a/delay_price.sh b/delay_price.sh index 723a14f..9f9fde7 100644 --- a/delay_price.sh +++ b/delay_price.sh @@ -1,5 +1,5 @@ #!/bin/bash -source /env +source /app/env sleep 2 -python3 /get_price.py >> /var/log/cron.log 2>&1 \ No newline at end of file +python3 /app/get_price.py >> /var/log/cron.log 2>&1 \ No newline at end of file diff --git a/start.sh b/start.sh index a7f6c90..6e0fa6c 100644 --- a/start.sh +++ b/start.sh @@ -1,5 +1,5 @@ #!/bin/bash - +printenv > /app/env # Start the cron service service cron start