diff --git a/BankServices/RoutineEmailService/Dockerfile b/BankServices/RoutineEmailService/Dockerfile index 93af9f3..9793e43 100644 --- a/BankServices/RoutineEmailService/Dockerfile +++ b/BankServices/RoutineEmailService/Dockerfile @@ -14,18 +14,15 @@ 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 +# Copy application code +COPY /BankServices/RoutineEmailService / + +# Make run_app.sh executable +RUN chmod +x /run_app.sh # 11:00 Istanbul Time (UTC+3) system time is 08:00 UTC 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 / - COPY /Schemas /Schemas COPY /Controllers /Controllers COPY /BankServices/ServiceDepends / diff --git a/BankServices/RoutineEmailService/run_app.sh b/BankServices/RoutineEmailService/run_app.sh new file mode 100644 index 0000000..86bc980 --- /dev/null +++ b/BankServices/RoutineEmailService/run_app.sh @@ -0,0 +1,13 @@ +#!/bin/bash +export EMAIL_HOST="10.10.2.34" +export EMAIL_USERNAME="karatay@mehmetkaratay.com.tr" +export EMAIL_PASSWORD="system" +export EMAIL_PORT=587 +export EMAIL_SEND=1 +export DB_HOST="10.10.2.14" +export DB_USER="postgres" +export DB_PASSWORD="password" +export DB_PORT=5432 + +env >> /var/log/cron.log +/usr/local/bin/python /app.py \ No newline at end of file