Skip to content

Commit

Permalink
Added a cron to run the cleanup task.
Browse files Browse the repository at this point in the history
  • Loading branch information
zimbres committed Oct 11, 2022
1 parent 7fab6b1 commit eff299a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:focal
ENV DEBIAN_FRONTEND noninteractive

RUN apt update
RUN apt install -y supervisor python3-pip
RUN apt install -y supervisor python3-pip cron

RUN apt clean && apt autoclean && rm -fr /var/lib/apt/lists/* && rm -fr /tmp/*

Expand All @@ -13,5 +13,6 @@ COPY ./ /app

WORKDIR /

RUN (crontab -l ; echo "*/2 * * * * python3 /app/manage.py cleanup") | crontab
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord"]
5 changes: 5 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ nodaemon=true
command=python3 /app/manage.py runserver 0.0.0.0:8000
stderr_logfile=/var/log/app.err.log
stdout_logfile=/var/log/app.out.log

[program:cron]
command=cron -f
stderr_logfile=/var/log/cron.err.log
stdout_logfile=/var/log/cron.out.log

0 comments on commit eff299a

Please sign in to comment.