updated Dockerfile

This commit is contained in:
berkay 2025-04-25 15:22:20 +03:00
parent 9f0c42e57a
commit 7efd6f8941
2 changed files with 18 additions and 8 deletions

View File

@ -14,18 +14,15 @@ RUN poetry config virtualenvs.create false && poetry install --no-interaction --
# Install cron for scheduling tasks # Install cron for scheduling tasks
RUN apt-get update && apt-get install -y cron RUN apt-get update && apt-get install -y cron
# Create a script to export environment variables and run the app # Copy application code
RUN echo '#!/bin/bash' > /run_app.sh && \ COPY /BankServices/RoutineEmailService /
echo 'export $(printenv | grep EMAIL_ | xargs)' >> /run_app.sh && \
echo '/usr/local/bin/python /app.py' >> /run_app.sh && \ # Make run_app.sh executable
chmod +x /run_app.sh RUN chmod +x /run_app.sh
# 11:00 Istanbul Time (UTC+3) system time is 08:00 UTC # 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 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 /Schemas /Schemas
COPY /Controllers /Controllers COPY /Controllers /Controllers
COPY /BankServices/ServiceDepends / COPY /BankServices/ServiceDepends /

View File

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