From 3a40807b898550395e3bf462bfa7df54b7f63692 Mon Sep 17 00:00:00 2001
From: Flo Bieringer <wertfrei@icloud.com>
Date: Sat, 19 Jun 2021 16:34:34 +0200
Subject: [PATCH] try some stuff

---
 Dockerfile           | 6 ++++++
 crontab              | 1 +
 docker-entrypoint.sh | 3 +++
 3 files changed, 10 insertions(+)
 create mode 100644 crontab

diff --git a/Dockerfile b/Dockerfile
index 76608bb..2f830e4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,6 +4,7 @@ FROM php:7.4-apache as base
 # Install system requirements
 RUN apt update && apt install -y  --no-install-recommends \
     default-mysql-client default-libmysqlclient-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libonig-dev libzip-dev libicu-dev \
+    cron \
     && rm -rf /var/lib/apt/lists/*
 
 # Install php extensions
@@ -53,6 +54,11 @@ COPY config_local.php /config/config_local.inc.php
 COPY docker-entrypoint.sh /usr/local/bin/
 RUN chmod u+x /usr/local/bin/docker-entrypoint.sh
 
+# Add Cronjob
+COPY crontab /etc/cron.d/crontab
+RUN chmod 0644 /etc/cron.d/crontab
+RUN crontab /etc/cron.d/crontab
+
 # Set start parameters
 ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
 CMD ["apache2-foreground"]
diff --git a/crontab b/crontab
new file mode 100644
index 0000000..6fd7697
--- /dev/null
+++ b/crontab
@@ -0,0 +1 @@
+* * * * * root php /var/www/studip/cli/cronjob-worker.php >> /dev/null 2>&1
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 75c034a..753dce2 100644
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -64,4 +64,7 @@ if [ "${1#-}" != "$1" ]; then
 	set -- apache2-foreground "$@"
 fi
 
+# Start cron
+cron
+
 exec "$@"
-- 
GitLab