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 /