diff --git a/Dockerfile b/Dockerfile index 94b18fd..fb2dcd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/* @@ -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"] diff --git a/supervisord.conf b/supervisord.conf index 0577e67..871121f 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -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 \ No newline at end of file