Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Configure cron on apache image

Scott Peshakde46a49095fd
diff --git a/extras/docker/apache/Dockerfile b/extras/docker/apache/Dockerfile
index b43800073..19fd46b9b 100644
--- a/extras/docker/apache/Dockerfile
+++ b/extras/docker/apache/Dockerfile
@@ -24,6 +24,7 @@ ENV LC_ALL en_US.UTF-8
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
apache2 \
+ cron \
libapache2-mod-wsgi-py3 \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
@@ -35,6 +36,14 @@ RUN a2dissite 000-default.conf \
&& echo "ServerName localhost" >> /etc/apache2/conf-available/fqdn.conf \
&& a2enconf fqdn
+# Configure cron
+ADD crontab /etc/cron.d/wger
+ADD venvwrapper /home/wger/venvwrapper
+
+RUN chmod 0644 /etc/cron.d/wger \
+ && chmod +x /home/wger/venvwrapper \
+ && touch /var/log/cron.log
+
# Set up the application
USER wger
RUN git clone https://github.com/wger-project/wger.git /home/wger/src
diff --git a/extras/docker/apache/crontab b/extras/docker/apache/crontab
new file mode 100644
index 000000000..52f4e2e55
--- /dev/null
+++ b/extras/docker/apache/crontab
@@ -0,0 +1,6 @@
+# wger cron jobs
+0 5 * * * root /home/wger/venvwrapper email-reminders
+15 5 * * * root /home/wger/venvwrapper email-weight-reminders
+30 5 * * * root /home/wger/venvwrapper inactive-members
+42 4 * * * root /home/wger/venvwrapper delete-temp-users
+# Don't remove the empty line at the end of this file. It is required to run the cron job
diff --git a/extras/docker/apache/venvwrapper b/extras/docker/apache/venvwrapper
new file mode 100644
index 000000000..3d468d097
--- /dev/null
+++ b/extras/docker/apache/venvwrapper
@@ -0,0 +1,4 @@
+#!/bin/sh
+. /home/wger/venv/bin/activate
+
+/home/wger/src/manage.py "$@"