mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-05 13:15:18 +02:00
Auto schedule Django APScheduler
This commit is contained in:
parent
f5e721cd82
commit
590fa9edc0
5 changed files with 82 additions and 18 deletions
|
@ -13,7 +13,7 @@ WORKDIR /code
|
|||
|
||||
# Install system dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y git postgresql-client cron \
|
||||
&& apt-get install -y git postgresql-client \
|
||||
&& apt-get clean
|
||||
|
||||
# Install Python dependencies
|
||||
|
@ -27,18 +27,6 @@ COPY ./server /code/
|
|||
# Collect static files
|
||||
RUN python3 manage.py collectstatic --noinput --verbosity 2
|
||||
|
||||
# Setup cron to run python3 manage.py worldtravel-seed every day at 00:00
|
||||
RUN echo "0 0 * * * python3 /code/manage.py worldtravel-seed --force >> /var/log/cron.log 2>&1" > /etc/cron.d/worldtravel-seed
|
||||
|
||||
# Give execution rights on the cron job
|
||||
RUN chmod 0644 /etc/cron.d/worldtravel-seed
|
||||
|
||||
# Apply cron job
|
||||
RUN crontab /etc/cron.d/worldtravel-seed
|
||||
|
||||
# Ensure cron is started in the foreground when the container starts
|
||||
CMD ["cron", "-f"]
|
||||
|
||||
# Set the entrypoint script
|
||||
COPY ./entrypoint.sh /code/entrypoint.sh
|
||||
RUN chmod +x /code/entrypoint.sh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue