From 9f0c42e57ad51fd186c82ffa5bede51c111cecc9 Mon Sep 17 00:00:00 2001 From: berkay Date: Fri, 25 Apr 2025 15:03:47 +0300 Subject: [PATCH] updated mail Dockerfile with env variables --- BankServices/RoutineEmailService/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BankServices/RoutineEmailService/Dockerfile b/BankServices/RoutineEmailService/Dockerfile index 15d1369..93af9f3 100644 --- a/BankServices/RoutineEmailService/Dockerfile +++ b/BankServices/RoutineEmailService/Dockerfile @@ -14,8 +14,14 @@ RUN poetry config virtualenvs.create false && poetry install --no-interaction -- # Install cron for scheduling tasks RUN apt-get update && apt-get install -y cron +# Create a script to export environment variables and run the app +RUN echo '#!/bin/bash' > /run_app.sh && \ + echo 'export $(printenv | grep EMAIL_ | xargs)' >> /run_app.sh && \ + echo '/usr/local/bin/python /app.py' >> /run_app.sh && \ + chmod +x /run_app.sh + # 11:00 Istanbul Time (UTC+3) system time is 08:00 UTC -RUN echo "0 8 * * * /usr/local/bin/python /app.py >> /var/log/cron.log 2>&1" > /tmp/crontab_list && crontab /tmp/crontab_list +RUN echo "0 8 * * * /run_app.sh >> /var/log/cron.log 2>&1" > /tmp/crontab_list && crontab /tmp/crontab_list # Copy application code COPY /BankServices/RoutineEmailService /